nnoremap let g:mapleader = ' ' " Quickly insert an empty new line without entering insert mode nnoremap o o nnoremap O O " workman noremap noremap noremap e j noremap o k noremap n h noremap i l noremap k n noremap h e noremap l o noremap f u noremap u i noremap E J noremap O K noremap N H noremap I L noremap K N noremap H E noremap L O noremap F U noremap U I noremap ge gj noremap go gk noremap gn gh noremap gl go noremap gk gn noremap gh ge noremap gE gJ noremap gN gH noremap gK gN noremap gH gE noremap gL gO nnoremap e :wincmd j nnoremap o :wincmd k nnoremap n :wincmd h nnoremap i :wincmd l nnoremap k :wincmd n nnoremap l :wincmd o vnoremap B vnoremap W nnoremap B nnoremap W vnoremap b vnoremap w nnoremap b nnoremap w " nnoremap i e " get control-j back, so switch it with ctrl-n at qwerty position of j " imap " cmap inoremap cnoremap " half scroll up and down noremap noremap map " jump word in visual mode -- TODO " In insert or command mode, move normally by using Ctrl inoremap inoremap inoremap inoremap cnoremap cnoremap cnoremap cnoremap inoremap inoremap inoremap :+3i inoremap :-3i " easy config nmap :e $HOME/.vimrc nmap :so $HOME/.vimrc " Force saving files that require root permission command! SUDOwrite :execute 'w !sudo tee > /dev/null %' | edit! " TODO: C-S-o etc does not work " Bubble single lines nmap :m-2== nmap :m-2== nmap :m+== nmap :m+== imap :m-2==gi imap :m-2==gi imap :m+==gi imap :m+==gi " Bubble multiple lines vmap :m-2gv=gv vmap :m-2gv=gv vmap :m'>+gv=gv vmap :m'>+gv=gv " Indent lines using and vmap >gv nmap >> imap >>i vmap << imap < :lprevious " noremap :lnext " moving through buffers " noremap :bn " noremap :bp noremap bd :bd noremap wc :bd noremap bo :Bufonly " close preview nmap pc :pc " Remap window commands " map ws :wincmd s " map wv :wincmd v " map wc :wincmd c " map wn :wincmd n " map wo :wincmd o " map w+ :wincmd _ " map w- :wincmd " map w= :wincmd = " nmap + :vertical resize +20 " nmap - :vertical resize -20 " map :wincmd > " map :wincmd j " map :wincmd j " map :wincmd k " map :wincmd k " map :wincmd h " map :wincmd h " map :wincmd l " map :wincmd l " " nnoremap :wincmd k " nnoremap :wincmd j " nnoremap :wincmd h " nnoremap :wincmd l " inoremap :wincmd k " inoremap :wincmd j " inoremap :wincmd h " inoremap :wincmd l nnoremap :wincmd k nnoremap :wincmd j nnoremap :wincmd h nnoremap :wincmd l inoremap :wincmd k inoremap :wincmd j inoremap :wincmd h inoremap :wincmd l nnoremap :wincmd K nnoremap :wincmd J nnoremap :wincmd H nnoremap :wincmd L inoremap :wincmd K inoremap :wincmd J inoremap :wincmd H inoremap :wincmd L " tags nmap :exec("tjump ".expand("")) nmap :split:exec("tjump ".expand("")) " trigger NERDTree, Tagbar $ Co. nmap n :NERDTreeToggle nmap t :TagbarToggle " nmap f "zyaw :exe ":Ack ".@z."" nmap :CtrlP nmap :CtrlPTag nmap :CtrlPBuffer " grep word under cursor nnoremap f :lgr! "\b\b":cw " paste from system clipboard inoremap :set paste"+p :set nopaste " toggle spellcheck nmap :setlocal spell! spelllang=en_us " cursor jump " nnoremap 3k " inoremap :-3i " vnoremap 3k " nnoremap 3j " inoremap :+3i " vnoremap 3j " nnoremap 6k " inoremap :-6i " vnoremap 6k " nnoremap 6j " inoremap :+6i " vnoremap 6j nnoremap 3k vnoremap 3k nnoremap 3j vnoremap 3j nnoremap 6k vnoremap 6k nnoremap 6j vnoremap 6j " scrolling nnoremap 10 inoremap 10i vnoremap 10 nnoremap 10 inoremap 10i vnoremap 10 nnoremap 10 inoremap 10i vnoremap 10 nnoremap 10 inoremap 10i vnoremap 10 " F keys nmap :noh imap :noh nmap :YcmCompleter GoToDeclaration nmap :YcmCompleter GoTo nmap :YcmCompleter GoTo:wincmd o noremap :FufBuffer nmap :call ManCurrentWord() nmap :call DevHelpCurrentWord() nnoremap :call NERDComment("n", "Toggle") vnoremap :call NERDComment("v", "Toggle") " nmap " plugins etc noremap :NERDTreeToggle noremap :TagbarToggle inoremap :TagbarToggle " remap visual block nnoremap " write noremap :w inoremap :w " exit noremap :qa! inoremap :qa! " paste nnoremap "+gPl vnoremap :call Paste("v") inoremap :call Paste("i") " select all nnoremap ggVG inoremap :call Select() " fzf nnoremap ag :call fzf#vim#ag(expand(''), WithGitRoot()) nnoremap tg :call fzf#vim#tags(expand(''), {'options': '--exact --select-1 --exit-0'}) " gitgutter nmap ggt :GitGutterToggle nmap nh (GitGutterNextHunk) nmap bh (GitGutterPrevHunk) " ctrlp let g:ctrlp_prompt_mappings = { \ 'PrtBS()': ['', ''], \ 'PrtDelete()': [''], \ 'PrtDeleteWord()': [''], \ 'PrtClear()': [''], \ 'PrtSelectMove("j")': ['', ''], \ 'PrtSelectMove("k")': ['', ''], \ 'PrtSelectMove("t")': ['', ''], \ 'PrtSelectMove("b")': ['', ''], \ 'PrtSelectMove("u")': ['', ''], \ 'PrtSelectMove("d")': ['', ''], \ 'PrtHistory(-1)': [''], \ 'PrtHistory(1)': [''], \ 'AcceptSelection("e")': ['', '<2-LeftMouse>'], \ 'AcceptSelection("h")': ['', '', ''], \ 'AcceptSelection("t")': [''], \ 'AcceptSelection("v")': ['', ''], \ 'ToggleFocus()': [''], \ 'ToggleRegex()': [''], \ 'ToggleByFname()': [''], \ 'ToggleType(1)': ['', ''], \ 'ToggleType(-1)': ['', ''], \ 'PrtExpandDir()': [''], \ 'PrtInsert("c")': ['', ''], \ 'PrtInsert()': [''], \ 'PrtCurStart()': [''], \ 'PrtCurEnd()': [''], \ 'PrtCurLeft()': ['', '', ''], \ 'PrtCurRight()': ['', ''], \ 'PrtClearCache()': [''], \ 'PrtDeleteEnt()': [''], \ 'CreateNewFile()': [''], \ 'MarkToOpen()': [''], \ 'OpenMulti()': [''], \ 'PrtExit()': ['', '', ''], \ } nnoremap cd :cd %:p:h:pwd