set nocompatible " use vim defaults if $OS == "Windows_NT" highlight Normal guibg=black guifg=white else highlight Normal guibg=black guifg=grey90 language en_US.UTF-8 set enc=utf-8 set fenc=utf-8 endif set background=dark " makes syntax highlighing lighter syntax on """" " Disable use of the X display for console vim. This make copy-n-paste less " convenient, but it speeds up startup when remote. if ! has( "gui_running" ) let g:display_num = \ substitute( $DISPLAY , \ '^[[:alpha:]]*:\([[:digit:]]\+\)\.[[:digit:]]\+$' , '\1' ,"") if ( g:display_num >= 10 ) set clipboard=exclude:.* endif endif """" " Multibyte Display and input : " comma-separated list of font names "set guifontset=-*-*-medium-r-normal--14-*-*-*-c-*-*-* "set guifontset=-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 set guifontset=-misc-fixed-medium-r-normal--18-120-100-100-c-90 "set guifontset=-*-*-medium-r-normal--14-*-*-*-c-*-iso10646-1,-*-*-medium-r-normal--14-*-*-*-c-*-iso8859-1 "set guifontset=-*-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1, " \-*-arial-medium-r-normal--12-*-*-*-*-*-iso8859-1, " \-*-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-2, " \-*-arial-medium-r-normal--12-*-*-*-*-*-iso8859-2, " \*-r-* " gnome-teriminal's font " -b&h-lucidatypewriter-bold-r-normal-*-*-140-*-*-m-*-iso10646-1 " " The GTK+ version of GUI Vim does not use .Xdefaults, use ~/.gtkrc instead. " The default mostly works OK. But for the menus you might have to change " it. Example: > " " style "default" " { " " # c : character-cell " # m : monospaced " fontset="-*-*-medium-r-normal--14-*-*-*-c-*-*-*" " } " widget_class "*" style "default" " " """" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "" main config options set autoindent set tabstop=8 " Tabs (ASCII 0x09) are always 8 characters!!! set softtabstop=4 shiftwidth=4 " default indentation level set expandtab " use spaces instead of tabs for indentation set ruler " show cursor postion set esckeys " allow cursor keys in insert mode set showcmd " Show (partial) command in status line. "set hlsearch " Highlight all matches of the last search pattern (sometimes annoying, good for code) set showmatch " show matching parens/brackets set backspace=2 " allows for backspace beyond current insert session set joinspaces " insert 2 spaces after a period when joining lines set fileformat=unix " The Right Way(tm) " Don't be noisy, don't flash the screen set noerrorbells visualbell " note : this only works for the console! it is reset when gvim starts set t_vb= set guioptions-=T " no toolbar " When writing a buffer to a file, choices are : " o rename the file and create a new one ("no") " o truncate the original and fill it with new data ("yes") " " Need to truncate and re-fill with davfs/zope " set backupcopy=yes set backupskip="/mnt/.*zope.*" " enable the new filetype and indent plugins filetype on filetype plugin on filetype indent on " enable the :Man command runtime ftplugin/man.vim " redirect the 'K' command to use the internal :Man instead of the external man map K K " Show special features, (aka 'listchars') " valid types : tab , eol , trail , extends "set lcs=tab:>-,trail:· "set lcs=tab:>-,trail:\: set lcs=tab:>-,trail:. set list """ " partial ISO-8859-1 / Unicode table " " 00a2 : ¢ " 00a3 : £ " 00a4 : ¤ " 00a5 : ¥ " 00a9 : © " 00ab : « " 00ae : ® " 00b1 : ± " 00bb : » " 00b0 : ° (degree symbol) " 00b7 : · " 20ac : € (euro) " " set the 'modeline' option to pick up settings for particular files set modeline modelines=3 "set nomodeline " this takes effect when the syntax file is loaded let python_highlight_all=1 """""""""" " These are the defaults from the Debian package set nobackup " Don't keep a backup file set viminfo='20,\"50 " read/write a .viminfo file, don't store more than " 50 lines of registers set history=50 " keep 50 lines of command line history " Suffixes that get lower priority when doing tab completion for filenames. " These are files we are not likely to want to edit or read. set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc,.class,$py.class "set incsearch " Incremental search "set autowrite " Automatically save before commands like :next and :make """""""""" "" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" function! BraceStyle() set cinoptions=f1s{1s map [[ ?{w99[{ map ]] j0[[%/{ map ][ /}b99]} map [] k$][%?} endfunction function! UnBraceStyle() set cinoptions= unmap [[ unmap ]] unmap ][ unmap [] endfunction """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Auto commands : " Tabs are always 8 characters!!! autocmd BufCreate * set tabstop=8 " disable C preprocessor indenting by default, re-enable it for C/C++ files au BufRead * inoremap # X# " Aegis-based projects augroup Aegis au! au BufNewFile,BufRead ~/aegis/* set makeprg=aeb\ \\\# "au BufNew ~/aegis/* set makeprg=aeb\ \\\# "au BufEnter ~/aegis/* set makeprg=aeb\ \\\# "au VimEnter ~/aegis/* set makeprg=aeb\ \\\# augroup END augroup Ant au! au FileType xml set sts=4 sw=4 et tw=78 fo=tcrq2 fenc=utf-8 augroup END augroup BIND au! au FileType named set sts=8 sw=8 augroup END augroup C au! au BufNewFile *.c 0read ~/util/templates/C.c au FileType c set ai si sts=4 sw=4 et tw=78 fo=croq2 fenc=us-ascii au FileType c inoremap # # augroup END augroup Cpp au! au FileType cpp set ai si sts=4 sw=4 et tw=78 fo=croq2 fenc=us-ascii au FileType cpp inoremap # # augroup END augroup CVS au! au FileType cvs set tw=70 augroup END " The help files have lots of tabs in them augroup Help au! au FileType help set ts=8 nolist augroup END augroup HTML au! au FileType html set ai si sts=4 sw=4 et tw=78 augroup END augroup IDL au! au FileType idl set ai si sts=4 sw=4 et tw=78 fo=croq2 augroup END augroup Java au! au BufNewFile *.java 0read ~/util/templates/Java.java au FileType java set sts=4 sw=4 et tw=78 fo=croq2 fenc=utf-8 hls au FileType java set cino+=j1s "au FileType java set autoread "au FileType java set foldmethod=indent au FileType java set foldmethod=syntax " do I want everything collapsed when I open the file? "au FileType java set foldenable au FileType java set nofoldenable au FileType java syn region Block start="{" end="}" transparent fold " syn region Comment start="/\*" end="\*/" fold au FileType java call BraceStyle() augroup END augroup LaTeX au! au BufNewFile *.tex 0read ~/util/templates/LaTeX/LaTeX.tex au FileType tex set fo=tcrq2 tw=75 fenc=utf-8 augroup END augroup Mail au! au FileType mail set tw=70 fo=tcrq2 nomodeline au FileType mail set comments+=n:\| "au FileType mail set comments+=n:\|,n:%,n:\: " clear the old sig and go back to the beginning of the buffer au BufRead /tmp/mutt* normal :g/^| -- $/,/^$/-1d gg augroup END augroup Make au! " Don't expand tabs -- commands in a rule only matter if they begin with a " tab. Also display tabs using other characters so it is obvious what is " really there. au FileType make set noet ts=4 sts=4 sw=4 lcs=tab:>- list au FileType make set nofoldenable augroup END augroup Man au! au FileType man set nolist augroup END augroup Python au! au BufNewFile *.py 0read ~/util/templates/Python.py " see also :help smartindent , cinwords au FileType python set sts=4 sw=4 et tw=78 fo=croq2 hls au FileType python set comments=b:# " override C preprocessor indenting au FileType python inoremap # X# au FileType python set foldmethod=indent " do I want everything collapsed when I open the file? "au FileType python set foldenable au FileType python set nofoldenable " normally use utf-8 au FileType python set fenc=utf-8 augroup END augroup Sh au! au FileType sh set ai si sts=4 sw=4 et tw=78 fo=croq2 " winblows! if $OS != "Windows_NT" au FileType sh set fenc=us-ascii endif " see also :help smartindent , cinwords au FileType sh set autoindent smartindent au FileType sh set comments=b:# " disable C preprocessor indenting au FileType sh inoremap # X# augroup END augroup Vim au! au FileType vim set ai si sts=4 sw=4 et tw=78 fo=croq2 fenc=utf-8 augroup END " """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Project-specific options " centrallix augroup Centrallix au! "au BufRead ~/projects/oss/centrallix/cvs/* set ts=4 " someone's tinkering with my settings! au BufRead ~/projects/oss/centrallix/cvs/* set nomodeline au BufRead ~/projects/oss/centrallix/cvs/* call BraceStyle() "au BufRead ~/projects/oss/centrallix/cvs/* set cinoptions=f1s{1s "au BufRead ~/projects/oss/centrallix/cvs/* map [[ ?{w99[{ "au BufRead ~/projects/oss/centrallix/cvs/* map ]] j0[[%/{ "au BufRead ~/projects/oss/centrallix/cvs/* map ][ /}b99]} "au BufRead ~/projects/oss/centrallix/cvs/* map [] k$][%?} augroup END " roundup augroup Roundup au! " use latin1 (eg Roché's name) au BufNewFile,BufRead,BufWrite ~/projects/oss/roundup/* set fenc=latin1 au BufRead */roundup/*/CHANGES.txt set tw=78 augroup END " """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Some keyboard mappings: " don't show help when F1 is pressed -- I press it too much by accident map "map! inoremap " Buffer commands: map :split map :bp " previous buffer map :bn " next buffer map :bd " delete (close) the buffer " paste control map :set paste map :set nopaste imap :set paste imap set pastetoggle= " Make the up and down movements move by "display" lines: map j gj map k gk map gj map gk " some systems send S-Del when Shift-Backspace is pressed imap " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""