" An example for a vimrc file. " " Maintainer: Bram Moolenaar " Last change: 2008 Dec 17 " " To use it, copy it to " for Unix and OS/2: ~/.vimrc " for Amiga: s:.vimrc " for MS-DOS and Win32: $VIM\_vimrc " for OpenVMS: sys$login:.vimrc if filereadable("/etc/vimrc") source /etc/vimrc endif " When started as "evim", evim.vim will already have done these settings. if v:progname =~? "evim" finish endif " Use Vim settings, rather than Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " allow backspacing over everything in insert mode set backspace=indent,eol,start set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after,$VIM:vimfiles,$VIMRUNTIME,$VIM:vimfiles:after,$HOME/Marija-dj/vimvim/mvi if has("vms") set nobackup " do not keep a backup file, use versions instead else set backup " keep a backup file endif set nobackup " do not keep a backup file, use versions instead set hidden "set buffer option hidden set history=100 " keep 50 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set incsearch " do incremental searching set linespace=0 " No extra spaces between rows set nu " Line numbers on set showmatch " show matching brackets/parenthesis set incsearch " find as you type search set winminheight=0 " windows can be 0 line high set ignorecase " case insensitive search set smartcase " case sensitive when uc present set wildmenu " show list instead of just completing set wildmode=list:longest,full " command completion, list matches, then longest common part, then all. set whichwrap=b,s,<,>,[,] " backspace and cursor keys wrap to set scrolljump=5 " lines to scroll when cursor leaves screen set scrolloff=3 " minimum lines to keep above and below cursor set foldenable " auto fold code set gdefault " the /g flag on :s substitutions by default set virtualedit=onemore " allow for cursor beyond last character set tabpagemax=15 " only show 15 tabs set showmode " display the current mode set cursorline " highlight current line hi cursorline guibg=#333333 " highlight bg color of current line hi CursorColumn guibg=#333333 " highlight cursor if has('cmdline_info') set ruler " show the ruler set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids set showcmd " show partial commands in status line and " selected characters/lines in visual mode endif " Formatting { set nowrap " wrap long lines set shiftwidth=2 " use indents of 2 spaces set expandtab " tabs are spaces, not tabs set tabstop=2 " an indentation every 2 columns set softtabstop=2 " let backspace delete indent "set matchpairs+=<:> " match, to be used with % set pastetoggle= " pastetoggle (sane indentation on pastes) " Stupid shift key fixes cmap W w cmap WQ wq cmap wQ wq cmap Q q cmap Tabe tabe " Yank from the cursor to the end of the line, to be consistent with C and D. nnoremap Y y$ "To use gw to swap the current word with the next, without changing "cursor position: " This version will work across newlines: nnoremap gw "_yiw:s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/ "To use gl to swap the current word with the previous, keeping cursor on current word nnoremap gl "_yiw?\w\+\_W\+\%#:s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/ "clearing highlighted search nmap / :nohlsearch "ovov Kwdb nesto ne radi to je za zatvaranje buffera "nmap Kwbd " Don't use Ex mode, use Q for formatting map Q gq " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, " so that you can undo CTRL-U after inserting a line break. inoremap u " za completition, da nemora da se stiska ctrl-x inoremap ^] ^X^] inoremap ^F ^X^F inoremap ^D ^X^D inoremap ^L ^X^L " Easier moving in tabs and windows map j_ map k_ map l_ map h_ map k_ " Shortcuts " Change Working Directory to that of the current file cmap cwd lcd %:p:h cmap cd. lcd %:p:h cmap nh :nohls " In many terminal emulators the mouse works just fine, thus enable it. if has('mouse') set mouse=r endif " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif "colorscheme desert " load a colorscheme "colorscheme wombat "colorscheme torte " load a colorscheme "colorscheme tortemarija "runtime! $HOME/Marija_dj/djvim/testwombat.vim "colorscheme testwombat "colorscheme koehler colorscheme mango2 "highlight LineNr term=NONE cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=Black guibg=#589A5D "highlight StatusLineNC term=NONE cterm=NONE ctermfg=NONE ctermbg=DarkGrey highlight vertsplit term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE "highlight Comment ctermfg=LightBlue gui=none cterm=none term=none "hi comment used in tango colorscheme hi Comment ctermfg=darkgrey cterm=bold " Define commenting functions: I guess this works only if called ^;;^ " nohlsearch : to disable highlighted match for this 'search' function! PoundComment() map _ :s/^/# /:nohls map - :s/^\s*# \=//:nohls set comments=:# endfunction function! ExclamationMarkComment() map _ :s/^/! /:nohls map - :s/^\s*! \=//:nohls " map :s/^\s*! \=// set comments=:! endfunction function! StarComment() map _ :s/^/* /:nohls map - :s/^\s** \=//:nohls set comments=:* endfunction " Will be called by default, just in case autocmd is disabled ^;;^ call ExclamationMarkComment() " Only do this part when compiled with support for autocommands. if has("autocmd") " Deternmine commenting mark based on filetype autocmd FileType perl call PoundComment() autocmd FileType csh call PoundComment() autocmd FileType sh call PoundComment() autocmd FileType fortran call ExclamationMarkComment() autocmd FileType grads call StarComment() " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. filetype on filetype plugin indent on " Put these in an autocmd group, so that we can delete them easily. augroup vimrcEx au! " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=80 " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). " Also don't do it when the mark is in the first line, that is the default " position when opening a file. autocmd BufReadPost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif augroup END else set autoindent " always set autoindenting on endif " has("autocmd") "koristi syntaxhighlighting za omnicomplete kad nema podrzan filetype if has("autocmd") && exists("+omnifunc") autocmd Filetype * \ if &omnifunc == "" | \ setlocal omnifunc=syntaxcomplete#Complete | \ endif endif " Convenient command to see the difference between the current buffer and the " file it was loaded from, thus the changes you made. " Only define it when not defined already. if !exists(":DiffOrig") command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis \ | wincmd p | diffthis endif