" vimrc file based on the Linux-Mandrake configuration " by Chmouel Boudjnah " Don't set vi-compatibility set nocp "Syntax highlighting only for enhanced-vi "if has("mouse_gpm") && filereadable("/usr/share/vim/syntax/syntax.vim") if has("syntax") syntax on endif "Set a statusbar set statusline=~ "I know it's horrible for a vi master but useful for newbies. """"imap I """"imap A """"map w """"imap w """"cmap "Some macros to manage the buffer of vim map :bp map :bn map :bd "Default backspace like normal "set bs=2 " allow backspacing over everything in insert mode set backspace=indent,eol,start set hidden " allows to change buffer w/o saving current buffer set nobackup " do not keep a backup file, use versions instead set history=50 " keep 50 lines of command line history set showcmd " display incomplete commands set ruler " show the cursor position all the time set statusline=%<%f%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%) set incsearch " do incremental searching set ignorecase " do case insensitive search set showmatch " show matching parenthese set mps+=<:> " make % work with <> set autoindent " always set autoindenting on set nowrap set noexpandtab set tabstop=4 set shiftwidth=4 set foldmethod=marker set foldlevel=1 " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif "Terminal for 80 char ? so vim can play till 79 char. "set textwidth=79 "Display a status-bar. "set laststatus=2 "" Gzip and Bzip2 files support " Take from the Debian package and the exemple on $VIM/vim_exemples if has("autocmd") " Set some sensible defaults for editing C-files 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 " Also, support editing of gzip-compressed files. DO NOT REMOVE THIS! " This is also used when loading the compressed helpfiles. augroup gzip " Remove all gzip autocommands au! " 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 autocmd BufReadPre,FileReadPre *.gz set bin autocmd BufReadPre,FileReadPre *.gz let ch_save = &ch|set ch=2 autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip autocmd BufReadPost,FileReadPost *.gz set nobin autocmd BufReadPost,FileReadPost *.gz let &ch = ch_save|unlet ch_save autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . %: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 bzip2 " Remove all bzip2 autocommands au! " Enable editing of bzipped 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 autocmd BufReadPre,FileReadPre *.bz2 set bin autocmd BufReadPre,FileReadPre *.bz2 let ch_save = &ch|set ch=2 autocmd BufReadPost,FileReadPost *.bz2 set cmdheight=2|'[,']!bunzip2 autocmd BufReadPost,FileReadPost *.bz2 set cmdheight=1 nobin|execute ":doautocmd BufReadPost " . %:r autocmd BufReadPost,FileReadPost *.bz2 let &ch = ch_save|unlet ch_save 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 -9 --repetitive-best :r augroup END endif " has ("autocmd") colorscheme koehler " use this color scheme set background=dark set guioptions-=T " remove toolbar set guifont=Monospace\ 9