" avoid warning for wrong version : version 4.0 " Use Vim defaults (much better!) set nocompatible " allow backspacing over everything in insert mode set bs=2 " always limit the width of text to : set tw=72 " indent mode : " set cindent " mouse setting : "set mouse=a " line warping : set nowrapscan " show matching : set showmatch " and mode : set showmode " set smartindent : " set uc=0 " Make delete & backspace work : set t_kD=^? " Must be after setting t_kD : map ^H X " Make DEL work : map [3~ x " Switch on search pattern highlighting : " set hlsearch " I like highlighting strings inside C comments : let c_comment_strings=1 " Color for xiterm, rxvt, nxterm, color-xterm : if has("terminfo") set t_Co=8 set t_Sf=[3%p1%dm set t_Sb=[4%p1%dm else set t_Co=8 set t_Sf=[3%dm set t_Sb=[4%dm endif " Color syntax hilighting : if &t_Co > 1 syntax on endif " Enable editing of gzipped files " read: set binary mode before reading the file " uncompress text in buffer after reading " write: compress file after writing " append: uncompress file, append, compress file augroup gzip " Remove all gzip autocommands au! autocmd BufReadPre,FileReadPre *.gz set bin autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip autocmd BufReadPost,FileReadPost *.gz set nobin autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r") autocmd BufWritePost,FileWritePost *.gz !mv :r autocmd BufWritePost,FileWritePost *.gz !gzip :r autocmd FileAppendPre *.gz !gunzip autocmd FileAppendPre *.gz !mv :r autocmd FileAppendPost *.gz !mv :r autocmd FileAppendPost *.gz !gzip :r augroup END augroup bzip " Remove all bzip autocommands au! autocmd BufReadPre,FileReadPre *.bz2 set bin autocmd BufReadPost,FileReadPost *.bz2 '[,']!bunzip2 autocmd BufReadPost,FileReadPost *.bz2 set nobin autocmd BufReadPost,FileReadPost *.bz2 execute ":doautocmd BufReadPost " . expand("%:r") autocmd BufWritePost,FileWritePost *.bz2 !mv :r autocmd BufWritePost,FileWritePost *.bz2 !bzip2 :r autocmd FileAppendPre *.bz2 !bunzip2 autocmd FileAppendPre *.bz2 !mv :r autocmd FileAppendPost *.bz2 !mv :r autocmd FileAppendPost *.bz2 !bzip2 :r augroup END augroup cprog " Remove all cprog autocommands au! " When starting to edit a file: " For *.c and *.h files set formatting of comments and set C-indenting on. " For other files switch it off. " Don't change the order, it's important that the line with * comes first. autocmd BufRead * set formatoptions=tcql nocindent comments& autocmd BufRead *.c,*.h set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,:// augroup END