set nocompatible " Use Vim defaults instead of 100% vi compatibility set backspace=indent,eol,start " more powerful backspacing set nobackup " Don't keep a backup file set history=500 " keep 50 lines of command line history set ruler " show the cursor position all the time set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc if has("autocmd") filetype plugin on endif try " {{{ print stuff if filereadable('/etc/papersize') let s:papersize = matchstr(system('/bin/cat /etc/papersize'), '\p*') if strlen(s:papersize) let &printoptions = "paper:" . s:papersize endif unlet! s:papersize endif catch /E145/ endtry " }}} set showcmd " Show (partial) command in status line. set showmatch " Show matching brackets. set ignorecase " Do case insensitive matching set incsearch " Incremental search set autowrite " Automatically save before commands like :next and :make if filereadable("/etc/vim/vimrc.local") source /etc/vim/vimrc.local endif let loaded_matchparen=1 set tabstop=2 set shiftwidth=2 set pastetoggle= set background=dark set foldmethod=marker set ai set t_Co=256 " Save last position in a file au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g'\"" | endif syntax on let g:xml_syntax_folding = 1 set statusline=%5*[%n]%*\ %1*%<%.99f%*\ %2*%h%w%m%r%y%*%=%-16(\ %3*%l,%c-%v%*\ %)%4*%P%* function! s:gotoline() " {{{ Open files on a given line (filename:n) let file = bufname("%") let names = matchlist( file, '\(.*\):\(\d\+\)') if len(names) != 0 && filereadable(names[1]) exec ":e " . names[1] exec ":" . names[2] if foldlevel(names[2]) > 0 exec ":foldopen!" endif endif endfunction autocmd! BufNewFile *:* nested call s:gotoline() " }}} " {{{ Filetype-specific " Makefiles au BufNewFile,BufRead *[mM]akefile set ts=4 sw=4 " Ruby, Rails au BufNewFile,BufRead *.rb,*.rhtml,*.rxml,*.rjs,*.erb set ts=2 sw=2 " for .c files au BufNewFile,BufRead *.c,*.cpp set ts=4 sw=4 " }}}