set nocompatible syntax on filetype on filetype plugin on filetype indent on set history=1000 set showmatch set matchtime=0 set shortmess=atI set ruler set showcmd set sidescroll=1 set sidescrolloff=3 " Set xterm title set title " Search options set hlsearch set incsearch set ignorecase set smartcase set visualbell set noerrorbells set printoptions=paper:letter " Keep more lines of context set scrolloff=3 " Make backspace delete lots of things set backspace=indent,eol,start " Auto-backup files and .swp files don't go to pwd set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp " Allow switching edited buffers without saving set hidden " Look for the file in the current directory, then south until you reach home. set tags=tags;~/ " Who needs .gvimrc? if has('gui_running') set encoding=utf-8 "set guifont=Monospace\ Bold\ 9 set guifont=Bitstream\ Vera\ Sans\ Mono\ 9 " Turn off toolbar and menu set guioptions-=T set guioptions-=m colorscheme inkpot else colorscheme desert end " Change let mapleader = "," " Quick timeouts on key combinations. set timeoutlen=300 " Alternatives to ESC: "imap jkl "imap jlk "imap kjl "imap klj "imap lkj "imap ljk "imap ;l " "Very magic" regexes in searches "nnoremap / /\v "nnoremap ? ?\v " Vi-style editing in the command-line "nnoremap : q:a "nnoremap / q/a "nnoremap ? q?a " Lusty "let g:LustyJugglerShowKeys = 2 let g:LustyExplorerSuppressRubyWarning = 1 "let g:LustyExplorerAlwaysShowDotFiles = 1 nmap f :FilesystemExplorer nmap b :BufferExplorer nmap r :FilesystemExplorerFromHere nmap g :LustyJuggler nmap j :so ~/.vim/plugin/lusty-explorer.vim nmap :JugglePrevious " Window management "nmap xo :wincmd j " Catch trailing whitespace set listchars=tab:>-,trail:ยท,eol:$ nmap s :set nolist! " Fix command typos (stolen from Adam Katz) nmap ; : " ` is more useful than ' but less accessible. nnoremap ' ` nnoremap ` ' " Buffer management nmap :bp nmap :bn "nmap :b# "nmap :bd nmap :bw vmap :bw " Toggle highlighting " nmap :silent :set nohls!:silent :set nohls? nmap :silent :nohlsearch " Scroll faster nnoremap 3 nnoremap 3 vnoremap 3 vnoremap 3 " % matches on if/else, html tags, etc. runtime macros/matchit.vim " Bash-like filename completion set wildmenu set wildmode=list:longest set wildignore=*.o,*.fasl autocmd BufRead *.qcf set filetype=lisp autocmd BufRead qpx.inc set filetype=make autocmd BufRead letter* set filetype=mail autocmd Filetype mail set fo -=l autoindent spell " ITA indenting style autocmd Filetype c,cpp,h set tabstop=4 softtabstop=4 shiftwidth=4 expandtab " JSH indenting style "autocmd Filetype c,cpp,h set tabstop=8 softtabstop=4 shiftwidth=4 noexpandtab " Wimba indenting style, sort-of "autocmd Filetype c,cpp,h set tabstop=2 softtabstop=2 shiftwidth=2 expandtab " Viewglob "autocmd Filetype c,cpp,h,sh set cindent autoindent autocmd Filetype sh set ts=4 shiftwidth=2 expandtab autocmd Filetype lisp,ruby,xml,html set ts=8 shiftwidth=2 expandtab autocmd Filetype python set ts=4 shiftwidth=4 expandtab autocmd Filetype xml,xslt,diff,ruby color desert autocmd Filetype xml,xslt,diff,ruby set expandtab autocmd BufReadPre viper,.viper set filetype=lisp " a.vim nmap h :A " Indent XML readably function! DoPrettyXML() 1,$!xmllint --format --recover - endfunction command! PrettyXML call DoPrettyXML()