"" No need to be compatible with vi and lose features. set nocompatible "" Set textwidth to 80, this implies word wrap. set textwidth=80 "" Show line numbers. set nu "" Automatic C-style indenting. set autoindent "" When inserting TABs replace them with the appropriate number of spaces set expandtab "" But TABs are needed in Makefiles au BufNewFile,BufReadPost Makefile se noexpandtab "" Show matching braces. set showmatch "" Choose the right syntax highlightning per TAB-completion :-) "" map :source $VIM/syntax/ "" Syntax highlightning, but only for color terminals. if &t_Co > 1 syntax on endif "" Set update time to 1 second (default is 4 seconds), convenient vor taglist.vim. set updatetime=500 "" Colours in xterm. map :se t_Co=16:se t_AB=[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm:se t_AF=[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm "" Toggle between .h and .cpp with F4. function! ToggleBetweenHeaderAndSourceFile() let bufname = bufname("%") let ext = fnamemodify(bufname, ":e") if ext == "h" let ext = "cpp" elseif ext == "cpp" let ext = "h" else return endif let bufname_new = fnamemodify(bufname, ":r") . "." . ext let bufname_alt = bufname("#") if bufname_new == bufname_alt execute ":e#" else execute ":e " . bufname_new endif endfunction map :call ToggleBetweenHeaderAndSourceFile() "" Keep the horizontal cursor position when moving vertically. set nostartofline "" Reformat comment on current line. TODO: explain how. map hc ==I :.s/\/\/ */\/\//:nohlsearchj "" Make sure == also indents #ifdef etc. noremap == IX==:.s/X//:nohlsearch "" Toggle encoding with F12. function! ToggleEncoding() if &encoding == "latin1" set encoding=utf-8 elseif &encoding == "utf-8" set encoding=latin1 endif endfunction map :call ToggleEncoding() "" Do not break long lines. set nowrap set listchars=eol:$,extends:> "" Next / previous error with Tab / Shift+Tab. map :cn map :cp map :cp "" Umlaut mappings for US keyboard. imap "a ä imap "o ö imap "u ü imap "s ß imap "A Ä imap "O Ö imap "U Ü "" After this many msecs do not imap. set timeoutlen=500 "" Always show the name of the file being edited. "" set ls=2 "" Show the mode (insert,replace,etc.) set showmode "" No blinking cursor please. set gcr=a:blinkon0 "" Cycle through completions with TAB (and SHIFT-TAB cycles backwards). function! InsertTabWrapper(direction) let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\" elseif "backward" == a:direction return "\" else return "\" endif endfunction inoremap =InsertTabWrapper ("forward") inoremap =InsertTabWrapper ("backward") "" Cycling through Windows quicker. map j_ map k_ map _ map _ map | map | "" Do not show any line of minimized windows set wmh=0 "" Make it easy to update/reload _vimrc. :nmap ,s :source $HOME/.vimrc :nmap ,v :sp $HOME/.vimrc "" Latex Suite 1.5 wants it "" REQUIRED. This makes vim invoke latex-suite when you open a tex file. filetype plugin on "" IMPORTANT: win32 users will need to have 'shellslash' set so that latex "" can be called correctly. set shellslash "" IMPORTANT: grep will sometimes skip displaying the file name if you "" search in a singe file. This will confuse latex-suite. Set your grep "" program to alway generate a file-name. set grepprg=grep\ -nH\ $* "" OPTIONAL: This enables automatic indentation as you type (by 2 spaces) filetype indent on set sw=2 "" no placeholders please let g:Imap_UsePlaceHolders = 0 "" no " conversion please let g:Tex_SmartKeyQuote = 0 "" don't use Makefile if one is there let g:Tex_UseMakefile = 0 "" Syntax Highlighting for MhonArc Config files au BufNewFile,BufRead *.mrc so $HOME/.vim/mhonarc.vim "" set guifont=Courier10_BT/Roman/10 set gfn=Courier\ 10\ Pitch\ 10 set gfw= set go=agimrLtT