" Initialize {{{ set nocompatible let mapleader="," set shell=/bin/zsh " NeoBundles! {{{ if has('vim_starting') set runtimepath+=~/.vim/bundle/neobundle.vim/ endif call neobundle#rc(expand('~/.vim/bundle/')) NeoBundleFetch 'Shougo/neobundle.vim' NeoBundle 'aerosol/vimerl' NeoBundle 'aerosol/vim-themer' NeoBundle 'aerosol/vim-session' NeoBundle 'aerosol/vim-easytags' NeoBundle 'kana/vim-tabpagecd' NeoBundle 'gcmt/taboo.vim.git' NeoBundle 'scrooloose/nerdcommenter' NeoBundle 'tpope/vim-fugitive' NeoBundle 'tpope/vim-sleuth.git' "NeoBundle 'godlygeek/tabular' NeoBundle 'Shougo/unite.vim.git' NeoBundle 'Shougo/vimfiler' NeoBundle 'thinca/vim-ref.git' NeoBundle 'Shougo/vimproc', { 'build': \ { 'mac' : 'make -f make_mac.mak', \ 'unix' : 'make -f make_unix.mak' } } NeoBundleCheck " }}} " }}} " Vimrc edit & reload {{{ nno Ve :tabedit $MYVIMRC nno Vr :source $MYVIMRC " }}} " Look & Feel {{{ if !has("gui_running") set mouse=a else " GUI-Specific {{{ " Theme {{{ set fillchars+=vert:\ ,fold:`,diff:_ set fuoptions=background:Normal set go-=T set go-=l set go-=L set go-=r set go-=R set go-=e set relativenumber map :set columns=120:set lines=40 nno ff :set invfullscreen:redraw! " }}} " Non-printing characters {{{ set list " Show certain nonprinting characters set listchars= " Defines how hidden chars are shown when in 'list' mode. set lcs+=tab:➟⋅ " Right triangle and middle dot for tab chars set lcs+=extends:› " Right single angle for chars right of the screen set lcs+=precedes:‹ " Left single angle for chars left of the screen set lcs+=nbsp:· " Middle dot for non-breaking spaces set lcs+=trail:· " Middle dot for trailing spaces " }}} endif " }}} " }}} " Editor propertites {{{ " Basic settings {{{ autocmd BufWritePre * :%s/\s\+$//e " Always jump to the last known cursor position. autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif set backspace=indent,eol,start set cmdheight=2 set display=lastline " Show as much of the last line as possible set enc=utf-8 " Default encoding set ff=unix set fileformats=unix set hidden set ignorecase set more set noerrorbells set novisualbell set visualbell t_vb= set report=2 " Always report the number of lines changed set ruler set scrolloff=3 set shortmess=aIT set showcmd " show the command being typed set sidescrolloff=3 set smartcase set title " Set descriptive window/terminal title set titlestring=%f%(\ [%M]%) set ttyfast set synmaxcol=800 set notimeout set ttimeout set ttimeoutlen=10 set confirm set cpoptions+=$ " }}} " Tabs & Windows {{{ nno H gT nno L gt set splitright set splitbelow nno :bp nno :bn no h no j no k no l nno x c nno X :bd nno v v nno s s nno > >> nno < << nno 5- nno 5+ nno 5< nno 5> nno :set lines-=1 nno :set lines+=1 nno :set columns-=1 nno :set columns+=1 au VimResized * :wincmd = " }}} " Text-wrap {{{ set formatoptions+=qrn1 set formatoptions-=o set wrap " }}} " Indentation {{{ set expandtab set shiftwidth=4 set softtabstop=4 set tabstop=8 " }}} " Search & Match {{{ set gdefault set hlsearch set incsearch set matchtime=2 set showmatch nno / :nohlsearch nno / /\V vno / /\V " }}} " Wildmenu {{{ set wildmenu set wildmode=list:full set wildignore+=.hg,.git,.svn set wildignore+=*.aux,*.out,*.toc set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest set wildignore+=*.spl set wildignore+=*.sw? set wildignore+=*.DS_Store set wildignore+=*.luac set wildignore+=migrations set wildignore+=*.pyc set wildignore+=*.beam " }}} " Omnicomplete {{{ set completeopt=longest,menuone set ofu=syntaxcomplete#Complete " }}} " Syntax {{{ syntax on filetype plugin indent on filetype on "setlocal spell spelllang=en " }}} " Statusline {{{ set laststatus=2 set statusline= set statusline+=\ λ\ ☛ set statusline+=%#error# set statusline+=%{&paste?'[paste]':''} set statusline+=%* set statusline +=\ %{&ff}\ %* "file format set statusline +=♈\ %{fugitive#statusline()} set statusline +=%{strlen(&fenc)?&fenc:'none'} "file encoding set statusline +=\ %<%F\ %* "full path set statusline +=\ \ %m%r%w\ %P\ \ "Modified? Readonly? Top/bot. set statusline +=%=%l%* "current line set statusline +=:%=%c%* set statusline +=\ T:%L%*\ "total lines set statusline +=%y\ %* "file type set statusline +=✪\ %{getcwd()} " }}} " Folding {{{ nno zR nno z zMzvzz set foldcolumn=0 set foldenable set foldlevel=99 set foldlevelstart=0 set foldmethod=marker " }}} " }}} " Navigation & editing shortcuts {{{ set nostartofline set pastetoggle= nnore # # " Moar blasphemy! cnore cnore cnore cnore nnore _l :left nnore _c :center nnore _r :right nmap nmap nno j gj nno k gk ino jj nno w :w vmap > >gv vmap < /dev/null " Stephen Hawking nno ,? :silent !say nno 0 ^ nno ^ 0 nno nno :bnext nno :bprevious nno g " }}} " Language-specific settings {{{ " Erlang {{{ "let g:erlang_highlight_bifs = 1 let g:erlang_folding = 1 "let g:erlangRefactoring = 0 "let g:erlangWranglerConfirmations = 0 "let g:erlangWranglerPath = '/Users/adam/dev/erl_libs/wrangler-1.0' let g:erlang_use_conceal = 1 map :w:!rebar compile skip_deps=true map :w:!rebar eunit skip_deps=true "nmap K :Man inore "" make gf work set sua+=.erl set sua+=.hrl let erlang_path=substitute(system("which erl"), "/bin/erl", "/lib/**/src/", "") exe ":set path+="."src/,deps/**/src/,apps/**/src/,**/include/,".erlang_path " jump to a module when there's no around function! GoToFile() call inputsave() let f = input('File/Module: ') call inputrestore() exec "find " . f endfunction nore :call GoToFile() " }}} " Python {{{ autocmd BufWritePre *.py normal m`:%s/\s\+$//e `` autocmd FileType python set omnifunc=pythoncomplete#Complete " }}} " XML BS {{{ let g:xml_syntax_folding=1 autocmd FileType xml let &l:equalprg='xmllint --format --recover -' autocmd FileType xml setlocal foldmethod=syntax " }}} " }}} " Undo & history {{{ set backup set backupdir=~/.vim/tmp// set history=5000 set noswapfile set undodir=~/.vim/tmp// set undofile set undolevels=5000 silent execute '!find ~/.vim/tmp/ -type f -mtime +60 -exec rm {} \;' silent execute '!mkdir ~/.vim/tmp > /dev/null 2>&1' " }}} " Plugin Settings {{{ " Taboo {{{ nnore ,T :TabooRenameTab " }}} " Fugitive {{{ no gd :Gdiff nno gs :Gstatus15+ nno gw :Gwrite nno ga :Gadd nno gb :Gblame nno gco :Gcheckout nno gci :Gcommit nno gm :Gmove nno gr :Gremove nno gl :Shell git gl -18:wincmd \| " Cleanup fugitive buffers autocmd BufReadPost fugitive://* set bufhidden=delete autocmd BufReadPost fugitive://* \ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' | \ nnoremap .. :edit %:h | \ endif " }}} " Vpaste {{{ :map vp :exec "w !vpaste ft=".&ft :vmap vp :exec "'<,'>w !vpaste ft=".&ft " }}} " Sessions {{{ let g:session_directory = expand('~/.vim/.sessions') let g:session_command_aliases = 1 let g:session_autosave = 'prompt' let g:session_default_to_last = 1 " }}} " Easytags {{{ let g:easytags_file = expand('~/.vim/tmp/tags') let g:easytags_auto_update = 0 let g:easytags_autorecurse = 1 " }}} " Unite {{{ augroup UniteAutoCmd autocmd! augroup END function! s:unite_tabs_and_windows() nmap h nmap j nmap k nmap l imap h imap j imap k imap l nmap H gT nmap L gt endfunction let g:unite_data_directory = '~/.vim/tmp/unite/' let g:unite_source_process_enable_confirm = 1 let g:unite_source_history_yank_enable = 1 let g:unite_enable_split_vertically = 0 let g:unite_winheight = 20 let g:unite_source_directory_mru_limit = 300 let g:unite_source_file_mru_limit = 300 let g:unite_source_file_mru_filename_format = ':~:.' let g:unite_source_grep_command = 'ack' let g:unite_source_grep_default_opts = '--column --no-color --nogroup --with-filename' let g:unite_source_grep_recursive_opt = '' nno a :Unite grep -start-insert -default-action=above -auto-preview nno A :execute 'Unite grep:.::' . expand("") . ' -default-action=above -auto-preview' nno b :Unite buffer -buffer-name=buffers -start-insert nno :UniteWithCurrentDir buffer file -buffer-name=united -start-insert nno ps ::Unite process -buffer-name=processes -start-insert nno u :Unite nno ::Unite history/yank -buffer-name=yanks nno // ::Unite line -buffer-name=lines -start-insert function! s:unite_settings() imap jj (unite_insert_leave) imap (unite_delete_backward_path) imap call s:unite_tabs_and_windows() endfunction autocmd UniteAutoCmd FileType unite call s:unite_settings() " wimviki replacement {{{ map W :Unite file file/new -buffer-name=notes -start-insert \ -toggle -default-action=split -profile-name=files \ -input=/Volumes/Vimwiki/ " }}} " VimFiler {{{ let g:vimfiler_data_directory = expand('~/.vim/tmp/vimfiler/') let g:vimfiler_safe_mode_by_default = 0 let g:vimfiler_execute_file_list = { "_": "vim" } nno ` ::VimFilerBufferDir -buffer-name=explorer -toggle function! s:vimfiler_settings() call s:unite_tabs_and_windows() nmap - (vimfiler_switch_to_parent_directory) nmap % (vimfiler_new_file) endfunction autocmd UniteAutoCmd Filetype vimfiler call s:vimfiler_settings() " }}} " Ref {{{ let g:ref_open = 'vsplit' let g:ref_cache_dir = expand('~/.vim/tmp/ref_cache/') nno K :Unite ref/erlang -buffer-name=erlang_docs -start-insert -horizontal " }}} " }}} " }}} " Other {{{ au ColorScheme * call ExtendColorScheme() function! ExtendColorScheme() " Highlight interesting words {{{ " Don't let colorschemes override these with 'hi clear' hi Wtf1 guifg=#000000 guibg=#00ff00 gui=NONE hi Wtf2 guifg=#ffffff guibg=#ff0000 gui=NONE hi Wtf3 guifg=#000000 guibg=#ffff00 gui=NONE nnoremap hh :execute 'match Wtf1 /\<\>/' nnoremap h1 :execute 'match Wtf1 /\<\>/' nnoremap h2 :execute '2match Wtf2 /\<\>/' nnoremap h3 :execute '3match Wtf3 /\<\>/' " }}} endfunction " }}}