My vimrc

From EggeWiki

Here's my usually settings for vim. These settings work well with rxvt and Cygwin.

<geshi lang="vim"> " Brian Egge's .vimrc

set nocompatible " We're running Vim, not Vi! set t_Co=256 " We're playing with a full box of Crayons if $TERM =~ 'the worst terminal ever'

 set t_Co=8              " just in case

endif " Got problems? Make sure your TERMINFO is set and maybe VIMRUNTIME syntax on " Enable syntax highlighting " colorscheme darkblue colorscheme elflord set hls " turn on highlighted search filetype plugin indent on " Enable filetype-specific indenting and plugins

" Load matchit (% to bounce from do to end, etc.) runtime! macros/matchit.vim

augroup myfiletypes

       " Clear old autocmds in group
       autocmd!
       " autoindent with two spaces, always expand tabs
       autocmd FileType * set tabstop=2|set shiftwidth=2
       autocmd FileType make,GNUmakefile,*.mk setlocal noexpandtab
       autocmd FileType ruby,eruby,yaml,perl set ai sw=2 sts=2 et
       autocmd FileType sh set ai ts=2 sw=2 sts=2 et
       autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8 softtabstop=4 smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,with
       au BufRead,BufNewFile *.C,*.H,*.hpp,*.h,*.c,*.cpp set ai ts=4 sw=4 sts=4 et

augroup END

set viminfo='10,\"100,:20,%,n~/.viminfo au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

map <F11> :if (&syntax=="msfixml") <Bar>
       \   set syntax= <Bar>
       \ else <Bar>
       \   set syntax=msfixml <Bar>
       \ endif <CR>

set ruler set ignorecase set incsearch set nobackup set backspace=indent,eol,start if filereadable('/ms/dist/fsf/PROJ/bash/login/bin/bash')

       set shell=/ms/dist/fsf/PROJ/bash/login/bin/bash

else

       set shell=/bin/bash

endif

" Perforce nnoremap p4add  :!p4 add %:e nnoremap p4edit :!p4 edit %:e nnoremap p4dff  :!p4 diff %

function! InsertStatuslineColor(mode)

 if a:mode == 'i'
   hi statusline guibg=Cyan ctermfg=6 guifg=Black ctermbg=0
 elseif a:mode == 'r'
   hi statusline guibg=Purple ctermfg=5 guifg=Black ctermbg=0
 else
   hi statusline guibg=DarkRed ctermfg=1 guifg=Black ctermbg=0
 endif

endfunction

au InsertEnter * call InsertStatuslineColor(v:insertmode) au InsertLeave * hi statusline guibg=DarkGrey ctermfg=8 guifg=White ctermbg=15

" default the statusline to green when entering Vim hi statusline guibg=DarkGrey ctermfg=8 guifg=White ctermbg=15

" Formats the statusline set statusline=%f " file name set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding set statusline+=%{&ff}] "file format set statusline+=%y "filetype set statusline+=%h "help file flag set statusline+=%m "modified flag set statusline+=%r "read only flag

set statusline+=\ %= " align left set statusline+=Line:%l/%L[%p%%] " line X of Y [percent of file] set statusline+=\ Col:%c " current column set statusline+=\ Buf:%n " Buffer number set statusline+=\ [%b][0x%B]\ " ASCII and byte code under cursor


</geshi>