Friday, September 12, 2008

vim settings

In vi you made a file named .exrc, in vim it is .vimrc, you may have both if you want. If there is no .vimrc, but there is a .exrc vim will use those settings and run in vi compatible mode, which will disable most of the vim enhancements.

On vulcan my .vimrc ( ~jclark/.vimrc ) is world readable so that you can copy and/or read it.

Here is an example .vimrc
I left out a map example since they don't display very well in html

" Here are John's
" vimrc settings
set wm=8 " set wrapmargin
set nohls " turn off highlight on search
set et " turn on expand tab
" colorscheme adjustments :hi lists the symbols and values for this
colo evening " change the colorscheme
" make the preprocessor stuff a lighter color
hi PreProc ctermfg=yellow
hi Constant cterm=underline,bold ctermfg=9
" turn on comment continuation for C style comments
set fo+=r " formatoptions r adds new comment line automagically
" only apply on C comments, and mail forwarding "> "
set com=s1:/*,mb:*,ex:*/,:>,fb:-
" for Makefiles
" added some special formatting in Makefiles
autocmd BufEnter ?akefile* set noet ts=8 sw=8 nocindent list lcs=tab:>-,trail:x
" for source code
autocmd BufEnter *.cpp,*.h,*.c,*.java,*.pl set et ts=4 sw=4 cindent
" change the filetype
autocmd BufEnter *.pro,*.prolog set et ts=4 sw=4 cindent ft=prolog
" for html
autocmd BufEnter *.html set et ts=4 sw=4 wm=8 nocindent
" abbreviations
ab teh the
ab tomarrow tomorrow
" The man plugin does lookup with control-k, or :Man
runtime ftplugin/man.vim

No comments: