" rezza's crazy .vimrc file. Some stuff added by me, some stuff cannibalized " from various sources around the net. Feel free to rip this apart and use it " to your own nefarious ends. " gui options and colorscheme selection if has('gui_running') set guifont=Bitstream\ Vera\ Sans\ Mono\ 8 set guioptions+=T set guioptions+=g set guioptions+=t set guioptions+=m set guioptions-=L set guioptions-=l set guioptions-=r set guioptions-=R set guioptions-=e colorscheme vividchalk map :browse confirm e else colorscheme default endif " basic options set bg=dark set cmdheight=1 set history=50 " set list listchars=tab:»·,trail:·,eol:þ set modeline set nocompatible set noerrorbells set novisualbell set nonumber set shortmess+=aIt set showcmd set showfulltag set showmatch set showmode set title set titlestring=%<%F set ttyfast set undolevels=1000 set viminfo='1000,f1,:1000,/1000 set wildmenu let Tlist_Auto_Open = 1 set number! " text layout settings set noexpandtab set wrap set whichwrap+=<,>,[,] " indent settings set autoindent set backspace=eol,start,indent set shiftwidth=2 set smartindent set softtabstop=2 set tabstop=2 " folding set foldmethod=marker " search options set cursorline set gdefault set incsearch set isk=@,48-57,_,192-255,-,.,@-@ set nohlsearch set noignorecase " set a toggle for pasting input set pastetoggle= " omnicompletion set completeopt=menu set tags+=~/.vim/systags " set bracket matching and comment formats set matchpairs+=<:> set comments-=s1:/*,mb:*,ex:*/ set comments+=s:/*,mb:**,ex:*/ set comments+=fb:* set comments+=b:\" set comments+=n:: " use less space for line numbering if possible if v:version >= 700 try setlocal numberwidth=3 catch endtry endif " use css for generated html files let html_use_css=1 " setup a funky statusline set laststatus=0 set statusline= set statusline+=%-3.3n\ " buffer number set statusline+=%t\ " file name set statusline+=%h%m%r%w " flags set statusline+=\[%{strlen(&ft)?&ft:'none'}, " filetype set statusline+=%{&fileencoding}, " fileencoding set statusline+=%{&fileformat}] " file format set statusline+=%= " right align set statusline+=0x%-8B\ " current char set statusline+=%-14.(%l,%c%V%)\ %<%P " offset " enable filetype detection filetype on filetype plugin on filetype indent on " autocommands " if has("autocmd") augroup default " clear previous autocmds, stops a few errors creeping in. autocmd! autocmd BufEnter * syntax sync fromstart " When editing a file, always jump to the last cursor position. autocmd BufReadPost * \ if line("'\"") && line("'\"") <= line("$") | \ exe "normal `\"" | \ endif autocmd Filetype * \ if &omnifunc == "" | \ setlocal omnifunc=syntaxcomplete#Complete | \ endif augroup end augroup filetypes autocmd! autocmd BufNewFile,BufRead *.tpl set filetype=html augroup end augroup tex autocmd! autocmd Filetype tex setlocal wrap autocmd FileType tex map \ll :silent make pdf autocmd FileType tex map \lv :silent make view autocmd BufNewFile *.tex silent 0r ~/.vim/templates/template.tex augroup end augroup c autocmd! autocmd FileType c,cpp setlocal formatprg=indent autocmd FileType c,cpp setlocal cindent cinoptions=:0,p0,t0 autocmd FileType c,cpp setlocal cinwords=if,else,while,do,for,switch,case autocmd FileType c,cpp setlocal expandtab autocmd Filetype c,cpp setlocal tabstop=8 shiftwidth=4 softtabstop=4 autocmd BufNewFile main.c silent 0r ~/.vim/templates/main.c augroup end augroup perl autocmd! autocmd Filetype perl setlocal number autocmd BufNewFile *.pl silent 0r ~/.vim/templates/template.pl augroup end augroup gnuplot autocmd! autocmd BufNewFile,BufRead *.plt,*.gp set filetype=gnuplot autocmd BufNewFile *.plt silent 0r ~/.vim/templates/template.plt augroup end endif " Make in normal mode go down a page rather than left a character noremap map :tabprev map :tabnext map :set number! map :setlocal spell! nnoremap :TlistToggle " enable syntax hilighting " syntax on nnoremap R gqap vnoremap R gq filetype plugin on filetype indent on au Syntax * syn match Error /\s\+$\| \+\ze\t/ " highlight extra whitespace