" " File: .vimrc " " Author: The original file was taken from Peter John's web site (www.pmade.org) " and slightly modified by Sergey Satskiy (satsky.spb.ru) " Some more were borrowed from Sergey Sikorskiy " And finally polished with Dima Kazimirov help " " No vi compatibility set nocompatible " ===== Taken from Dima Kazimirov's .vimrc " allow backspacing over everything in insert mode set backspace=indent,eol,start " Don't use Ex mode, use Q for formatting map Q gq " 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). autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif autocmd FileType cpp setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,:// " ===== " TAB stuff. Change the TABs to 4 spaces set et set ts=4 set softtabstop=4 set shiftwidth=4 set list listchars=tab:» ,trail:· " normally don't automatically format `text' as it is typed, IE only do this " with comments, at 79 characters: set formatoptions-=t set textwidth=79 " set textwidth=256 " for C-like programming, have automatic indentation: autocmd FileType c,cpp,slang set cindent " for actual C (not C++) programming where comments have explicit end " characters, if starting a new line in the middle of a comment automatically " insert the comment leader characters: autocmd FileType c set formatoptions+=ro " in makefiles, don't expand tabs to spaces, since actual tab characters are " needed, and have indentation at 8 chars to be sure that all indents are tabs " (despite the mappings later): autocmd FileType make set noexpandtab shiftwidth=8 " Delete trailing whitespace and tabs at the end of each line map :dtws :%s/[\ \t]\+$// " Comments fix " set fo+=cr " set scrolljump=4 set scrolloff=2 " Smart indent for C " set si " Or even more clever indents "set cindent " set statusline=%-f\ %-n%=[%Y%R%M][0x%B/L%l/C%c/B%o/%p%%] set statusline=%-f\ %-n%=[%Y%R%M][0x%B(%b)/L%l/C%c/%{&encoding}/%p%%] "set statusline=%<%f%h%m%r\ %b\ %{&encoding}\ 0x\ \ %l,%c%V\ %P set laststatus=2 " Sometimes it is required for SunOS " set t_kb= " set t_kD= set showmode set showcmd " Highlight the brackets match " set showmatch set matchtime=3 set incsearch " assume the /g flag on :s substitutions to replace all matches in a line: set gdefault " Ignore case when searching set ignorecase set noerrorbells set novisualbell set t_vb= set title " Do not create ~... files set nobackup abbreviate #i #include abbreviate #d #define filetype on set path+=/usr/include set termencoding=utf-8 " set backspace=indent,eol,start whichwrap+=<,>,[,] set tagstack set nowrap set number syntax off if &t_Co > 2 syntax on set hlsearch set incsearch " set spell hi clear Folded hi clear FoldColumn hi Search ctermfg=grey ctermbg=darkblue hi IncSearch ctermfg=darkgreen ctermbg=black hi Visual ctermfg=grey ctermbg=darkblue hi StatusLine ctermfg=darkblue ctermbg=grey hi StatusLineNC ctermfg=darkred ctermbg=grey hi Comment ctermfg=red " hi Constant ctermfg=yellow hi Constant ctermfg=magenta hi PreProc ctermfg=darkgreen " hi Statement ctermfg=lightblue cterm=bold hi Statement ctermfg=yellow cterm=bold hi Identifier ctermfg=darkgreen hi Folded ctermfg=magenta hi FoldColumn ctermfg=grey hi Cursor ctermfg=grey ctermbg=black hi ErrorMsg ctermfg=white ctermbg=darkred hi VertSplit ctermfg=brown " hi LineNr ctermfg=lightblue hi LineNr ctermfg=cyan hi ModeMsg ctermfg=cyan hi NonText ctermfg=cyan " Spell checker hi SpellBad ctermfg=white ctermbg=blue hi SpellCap ctermfg=white ctermbg=blue " hi SpellRare ctermfg " hi SpellLocal endif "# Cheat Sheet "# "# F1 - Turn on/off search highlighting "# F2 - Set the filetype to C++ "# F3 - Turn on/off spelling "# F4 - Open fist mentioned header file "# F5 - "# F6 - "# F7 - "# F8 - "# F9 - Grow current window "# F10 - Shrink current window "# F11 - Maximize current window "# F12 - Change to next window " Toggle search highlight nmap :let &hlsearch=!&hlsearch imap a nmap :set filetype=cpp imap nmap :let &spell=!&spell imap a nmap mzgg/include \"wlf15_w:nohls`z imap nmap :dtws imap a nmap + imap nmap - imap nmap _ imap nmap w imap map "vmap "+yi "imap "+gPi "set wildmenu "set wcm= "menu Encoding.koi8-r :e ++enc=koi8-r "menu Encoding.windows-1251 :e ++enc=cp1251 "menu Encoding.cp866 :e ++enc=cp866 "menu Encoding.utf-8 :e ++enc=utf8 "function InsertTabWrapper() " let col = col('.') - 1 " if !col || getline('.')[col - 1] !~ '\k' " return "\" " else " return "\" " endif "endfunction "imap =InsertTabWrapper()