" Change Leader let mapleader = ',' " General mappings {{{ " For US keyboard " See vim-sneak settings " nnoremap \ , " noremap : ; noremap ; : " noremap q; q: " don't use this, it makes quit mappings wait "}}} " Normal mode mappings {{{ " Be consistent with D and C nnoremap Y y$ " This might be replaced by ftplugins or plugin mappings (because 'make' means different things) nnoremap M :make " Q closes. nnoremap Q :q " close tab nnoremap Q :tabclose " C-w t to create new tab with current window (with current tab layout intact) nnoremap t sT " gF (takes line number into account) is better than gf nnoremap gf gF nnoremap gF gf nnoremap f F nnoremap F f " select last paste in visual mode nnoremap gb '`[' . strpart(getregtype(), 0, 1) . '`]' " tip: gv selects last selection again " make ( and ) work with Japanese sentences nnoremap ( ?[.。]:noh nnoremap ) /[.。]:noh " make [[ and ]] work with no {}-at-first-column restriction (:help section) nnoremap [[ ?{w99[{ nnoremap ][ /}b99]} nnoremap ]] j0?{w99[{%/{ nnoremap [] k$/}b99]}%?} "}}} " Comamnd line mappings {{{ " Emacs style cnoremap cnoremap cnoremap cnoremap cnoremap " Useful expantions cnoremap %P expand("%:p") cnoremap %H expand("%:h") cnoremap %T expand("%:t") cnoremap %R expand("%:t:r") " Jump into commandline window with cnoremap "}}} " Insert mode mappings {{{ " easy upcase inoremap gUiWgi " break undo chain when using insert mode deletions inoremap u inoremap u " emacs keybind inoremap inoremap " ^ is more useful than 0 in many cases inoremap ^ inoremap $ "}}} " Visual mode mappings {{{ " search with selection vnoremap * "zy:let @/ = @zn vnoremap "zy:Google " vnoremap E "zy:Ref webdict alc " " Pbcopy vnoremap Y :Pbcopy " }}} " make & trigger :&& so it preserves flags nnoremap & :&& xnoremap & :&&