" " $Id: config/laptop/vim/vimrc 1167 2012-07-12 23:26:30Z gjb $ " global settings syntax on set background=dark set number set ruler set textwidth=78 set nomodeline set autoindent set formatoptions=tcqn21 set shiftwidth=4 set softtabstop=4 set tabstop=8 set spelllang=en set nocompatible if filereadable("$HOME/.vim/plugin/matchit.vim") source $HOME/.vim/plugin/matchit.vim endif :filetype plugin on :filetype plugin indent on if has("autocmd") au BufNewFile,BufRead *.rb call Set_Ruby() au BufNewFile,BufRead *.sh call Set_Shell() au BufNewFile,BufRead *.cf call Set_Cfengine() au BufNewFile,BufRead *.php,*.html,*.hml,*.css,*.js,*.textile call Set_WWW() au BufNewFile,BufRead *.css call Set_CSS() au BufNewFile,BufRead *.js call Set_JavaScript() au BufNewFile,BufRead *.sgml,*.ent,*.xsl,*.xml,*.html call Set_SGML() au BufNewFile,BufRead *.[1-9] call ShowSpecial() au BufNewFile,BufRead Makefile,Makefile.inc*,*.mk set ft=make au BufNewFile,BufRead Makefile,Makefile.inc*,*.mk call ShowSpecial() au BufNewFile,BufRead *-mail,*.mail call Set_Mutt() au BufNewFile,BufRead *report*.txt,*-mail,*.mail set ft=mail au FileType mail,tex call Set_Mutt() au BufNewFile,BufRead .*.procmailrc,procmail.rc set filetype=procmail au BufNewFile,BufRead mailfilter,.mailfilter set filetype=perl au BufNewFile,BufRead .*.muttrc set filetype=muttrc au BufNewFile,BufRead *.*mutt*,*muttrc,mutt-* set filetype=muttrc au BufNewFile,BufRead mutt-nucleus-* set filetype=mail au BufNewFile,BufRead *.c,*.cpp,*.h call Set_C() au BufNewFile,BufRead *-pf.conf set ft=pf syn=pf au BufNewFile,BufRead *wiki set ft=moin syn=moin endif " has(autocmd) function Set_Ruby() setlocal textwidth=70 return 0 endfunction " Set_Ruby() function Set_C() set smartindent set autoindent set cindent set cinoptions=(4200,u4200,+0.5s,*500,:0,t0,U4200 set indentexpr=IgnoreParenIndent() set indentkeys=0{,0}},0),:,0#,!^F,o,O,e set noexpandtab set shiftwidth=8 set tabstop=8 set softtabstop=8 set textwidth=80 return 0 endfunction " Set_C() "" Ignore indents caused by parentheses in FreeBSD style. function! IgnoreParenIndent() let indent = cindent(v:lnum) if indent > 4000 if cindent(v:lnum - 1) > 4000 return indent(v:lnum - 1) else return indent(v:lnum - 1) + 4 endif else return (indent) endif endfun function Set_Shell() setlocal softtabstop=8 setlocal shiftwidth=8 setlocal tabstop=8 setlocal softtabstop=8 "call ShowSpecial() return 0 endfunction function Set_Cfengine() setlocal filetype=cf3 setlocal noautoindent setlocal nosmartindent setlocal softtabstop=8 setlocal shiftwidth=8 setlocal tabstop=8 setlocal noexpandtab "setlocal syntax=cf3 return 0 endfunction function Set_WWW() setlocal autoindent "setlocal smartindent setlocal textwidth=78 setlocal tabstop=8 setlocal softtabstop=4 setlocal shiftwidth=4 setlocal syntax=php.html setlocal ft=php.html return 0 endfunction " Set_WWW() function Set_CSS() setlocal ruler setlocal textwidth=78 setlocal tabstop=4 setlocal syntax=css setlocal ft=css return 0 endfunction " Set_CSS() function Set_JavaScript() setlocal ruler setlocal textwidth=78 setlocal tabstop=4 setlocal syntax=javascript setlocal ft=javascript return 0 endfunction " Set_JavaScript() function Set_SGML() setlocal number syn match sgmlSpecial "&[^;]*;" setlocal syntax=sgml setlocal filetype=xml setlocal shiftwidth=2 setlocal textwidth=70 setlocal tabstop=8 setlocal softtabstop=2 setlocal formatprg="fmt -p" setlocal autoindent setlocal smartindent :map P gqj :map T :s/ / / call ShowSpecial() call Set_Highlights() return 0 endfunction " Set_SGML() function Set_Highlights() highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%71v.\+/ return 0 endfunction function Set_Mutt() setlocal textwidth=72 setlocal noruler setlocal nonumber setlocal spell return 0 endfunction " Set_Mutt() function ShowSpecial() setlocal list listchars=tab:>>,trail:*,eol:$ hi nontext ctermfg=red return 0 endfunction " ShowSpecial() " wraps and quotes long lines :map Z omzk!$fmt 2x:.,'zs/^/> / 'zdd :map ;bc o----------- begin commit message -----------  :map ;ec o------------ end commit message ------------  :map ;bb o--------------------- begin quoted text ---------------------  :map ;ee o---------------------- end quoted text ----------------------