" Shortcut to vimrc and gvimrc nnoremap v :CtrlP ~/.vim " Comma get some... sorry. let mapleader = ',' let maplocalleader = '\' noremap ; : " Trigger to preserve indentation on pastes set pastetoggle= " Easier than escape. Pinnacle of laziness. imap jk " Turn off search highlighting noremap ? :nohlsearch " Navigation {{{ " Normalize all the navigation keys to move by row/col despite any wrapped text noremap j gj noremap k gk " % matchit shortcut, but only in normal mode! nmap % " Easier fold toggle nnoremap 5j vnoremap 5j nnoremap 5k vnoremap 5k " f: Find. Also support repeating with . nnoremap OriginalSemicolon ; nnoremap f :call repeat#set("\Plug>OriginalSemicolon")f nnoremap t :call repeat#set("\Plug>OriginalSemicolon")t nnoremap F :call repeat#set("\Plug>OriginalSemicolon")F nnoremap T :call repeat#set("\Plug>OriginalSemicolon")T " }}} " Editing {{{ nnoremap " Insert-mode navigation " Go to end of line inoremap A " Go to start of line inoremap I " Make Y act consistant with C and D nnoremap Y y$ " Don't leave visual mode after indenting vnoremap < >gv " Textmate-like CMD+Enter (O in insert mode) inoremap o inoremap O " Enabling repeat in visual mode vmap . :normal . " }}} " Buffers {{{ " Change CWD to current file's directory nnoremap cd :cd %:p:h:pwd " Next/prev buffer nnoremap ]b :bnext nnoremap [b :bprevious " }}} " Command {{{ " Annoying command mistakes com! -bang -nargs=* -complete=file E e com! -bang -nargs=* -complete=file W w com! -bang -nargs=* -complete=file Wq wq com! -bang -nargs=* -complete=file WQ wq com! -bang Wa wa com! -bang WA wa com! -bang Q q com! -bang QA qa com! -bang Qa qa " Forget to sudo? com! WW w !sudo tree % >/dev/null " Shortcuts cnoremap ;/ =expand('%:p:h').'/' cnoremap ;; =expand("%:t") cnoremap ;. =expand("%:p:r") " Mimic shortcuts in the terminal cnoremap cnoremap " }}} " External Tools {{{ " Send cwd to tmux nnoremap x :Tmux cd =expand("%:p:h") nnoremap X :Tmux cd =expand("%:p:r") " }}} " Plugins {{{ " bufkill nnoremap zx :Bdelete " CtrlP let g:ctrlp_map = '' " Only open CtrlP if the cwd ISN'T $HOME nnoremap / getcwd() != $HOME ? ":CtrlPCurWD" : ":echoe 'Cannot open CtrlP in HOME'" nnoremap . :CtrlPCurFile nnoremap , :CtrlPBuffer nnoremap ; :CtrlPFunky nnoremap m :CtrlPMRU nnoremap M :CtrlPModified nnoremap t :CtrlPBufTag nnoremap T :CtrlPBufTagAll " NERDTree map \ :NERDTreeCWD map . :NERDTreeFind " Tabularize nmap a= :Tabularize /= vmap a= :Tabularize /= nmap a> :Tabularize /=> vmap a> :Tabularize /=> nmap a: :Tabularize /: vmap a: :Tabularize /: nmap a:: :Tabularize /:\zs vmap a:: :Tabularize /:\zs nmap a, :Tabularize /, vmap a, :Tabularize /, nmap a :Tabularize / vmap a :Tabularize / " UltiSnips let g:UltiSnipsExpandTrigger = "" let g:UltiSnipsJumpForwardTrigger = "" let g:UltiSnipsJumpBackwardTrigger = "" " Ignore the default snippets so I (and others) can define their own let g:UltiSnipsSnippetDirectories = ["snips"] " Emmet imap emmet#expandAbbrIntelligent("\") " YCM map g] :YcmCompleter GoToDefinitionElseDeclaration let g:ycm_key_list_select_completion = ['', ''] let g:ycm_key_list_previous_completion = ['', ''] " vim-surround " I turned the keymappings around to restore the 'feedback' " I get from operator mode after common vim commands, like d " and c. let g:surround_no_mappings = 1 nmap sd Dsurround nmap sc Csurround nmap s Ysurround nmap S YSurround nmap ss Yssurround nmap Ss YSsurround nmap SS YSsurround xmap S VSurround xmap Sg VgSurround " vim-switch nnoremap :Switch " }}} " vim:set ft=vim: