""" hanumizzle's .vimrc
""" vim:foldmethod=marker
" General {{{1
" set encoding=utf-8
filetype plugin indent on
syntax enable
" 1337 coloring
if has('gui_running')
colorscheme desert
else
colorscheme ron
endif
" Other basic GUI options
set guifont=Monospace\ 12 " Larger font
set guioptions-=T " I find the toolbar useless
" Default filetype is text
autocmd BufRead,BufNewFile * setfiletype text
autocmd FileType text setlocal autoindent textwidth=78 formatoptions+=n
" Indentation {{{1
" I hate tabs ... huge indents are also terrible
set expandtab shiftwidth=2 softtabstop=2
" Python conventions request a four-space indent, but I still like two-space
" indent
" autocmd FileType python setlocal shiftwidth=4 softtabstop=4
" Persistence {{{1
" Preserve a lot of information and long history; see the user manual for
" full details
set viminfo=<1024,%,'1024,/1024,:1024,@1024,c,f1
set sessionoptions=buffers,curdir,folds,localoptions,options,resize
autocmd VimLeave * mksession! ~/.vim/session.vim
" Backup {{{1
" Backup files and try local .backup directory before $HOME
set backup backupdir=./.backup,~/.backup
" Try to make a .backup directory if possible
autocmd BufWritePre * call system('mkdir ' . expand('<afile>:p:h') . '/.backup')
" Keymapping {{{1
let maplocalleader='_'
" Open a file in the current directory
noremap <Leader>e :e <C-R>=expand('%:p:h') . '/'<CR>
noremap <Leader>s :split <C-R>=expand('%:p:h') . '/'<CR>
" Wrap the current paragraph
noremap <Leader>w gwip
" Search highlighting gets annoying
noremap <Leader>c :nohlsearch<CR>
" This one came from Salman Halim on the vim mailing list back in the day;
" executes all currently selected Vim script lines
function! Vim_execute()
execute getline('.')
endfunction
autocmd FileType vim noremap <buffer> <LocalLeader>v :call Vim_execute()<CR>
" C-w = (equalize window size) should ignore -MiniBufExplorer-, so this quick
" hack will take care of it
noremap <C-w>= :CMiniBufExplorer<CR><C-w>=:MiniBufExplorer<CR>
" Emacs-style keybindings for cmdline
cnoremap <C-a> <Home>
cnoremap <C-b> <Left>
cnoremap <C-d> <Del>
cnoremap <C-e> <End>
cnoremap <C-f> <Right>
cnoremap <C-n> <Down>
cnoremap <M-b> <S-Left>
cnoremap <M-f> <S-Right>
" Completion {{{1
" I hate cycling matches
set wildmode=list:longest
" MiniBufExplorer {{{1
let miniBufExplTabWrap = 1
let miniBufExplSplitBelow = 0
let miniBufExplMaxSize = 4
" taglist {{{1
let Tlist_Use_Horiz_Window = 1
let Tlist_WinHeight = 10
" Miscellaneous {{{1
set incsearch hlsearch " Incremental and highlighted search
set nowrap " Don't soft wrap long lines
set showmatch matchtime=4 " Show matching parentheses
" Allow back space over auto-indent and past start of insertion
set backspace=start,indent
set winaltkeys=no " Don't use Alt keys for menu
set visualbell " *beep* *beep* *beep* is a good way to annoy your roommate