" vimrc, http://sh.kirsle.net/ " Last Modified 2012/03/09 set encoding=utf8 " Unicode support lang en_US " English set nocompatible " use vim defaults set background=dark " my terminal has a black background set tabstop=4 " number of spaces for tab character set shiftwidth=4 " number of spaces to auto-indent set scrolloff=3 " keep 3 lines when scrolling set smartindent " smart auto-indenting (recognizes C-like code) set showmatch " hilite the matching brace when we type the closing brace set nohls " don't highlight search matches set incsearch " incremental search (search while you type) set ignorecase " case-insensitive search set showcmd " display incomplete commands set ttyfast " smoother changes set autowrite " automatic saving when quitting and switching buffer set autoread " automatic read when file is modified from outside " When vimrc is edited, reload it. autocmd! BufWritePost .vimrc source ~/.vimrc " Enable filetype plugin filetype plugin on filetype indent on " Tell Vim to remember things when we exit: " '10 : marks will be remembered for up to 10 previously edited files " "100 : will save up to 100 lines for each register " :20 : up to 20 lines of command-line history remembered " % : saves and restores the buffer list " n... : where to save the viminfo files set viminfo='10,\"100,:20,%,n~/.viminfo' " Restore the cursor position. function! ResCur() if line("'\"") <= line("$") normal! g`" return 1 endif endfunction augroup resCur autocmd! autocmd BufWinEnter * call ResCur() augroup END syntax on " syntax highlighting " check perl code with :make autocmd FileType perl set makeprg=perl\ -c\ %\ $* autocmd FileType perl set errorformat=%f:%l%m " make tab in v mode indent code vmap >gv vmap I nmap ^i " syntax highlight pod documentation correctly let perl_include_pod = 1 " syntax color complex things like @{${"foo"}} let perl_extended_vars = 1 " Make sure the syntax is always right, even when in the middle of " a huge javascript inside an html file. autocmd BufEnter * :syntax sync fromstart " change the bash title so the filename is first in the title bar let &titlestring = expand("%:t") . " - vim on " . hostname() if &term == "screen" set t_ts=k set t_fs=\ endif if &term == "screen" || &term == "xterm" set title endif