" ======================================================== " # Keyboard shortcuts " ======================================================== let mapleader = "\" " Ctrl+k as Esc nnoremap inoremap vnoremap snoremap xnoremap cnoremap onoremap lnoremap " Works in neovim not in vanilla vim tnoremap " Stop accidentally pulling up manpages nnoremap " Suspend with Ctrl+f inoremap :sus vnoremap :sus nnoremap :sus " Navigation ========================================= " Jump to line start/end using homerow noremap H ^ noremap L $ " Move by lines nnoremap j gj nnoremap k gk " Repeat last f/F/t/T motion forward nnoremap , ; vnoremap , ; onoremap , ; " Case insensitive search nnoremap / /\c " Jump to grep matches nnoremap gn :cnext nnoremap gN :cprev " Seach current word nnoremap tj viwy/" " Emacs-like movements "inoremap "inoremap inoremap inoremap inoremap " Jump to end of line inoremap inoremap " Command prompt ========================================= " ; as : for commands nnoremap ; : vnoremap ; : " Emacs-like movements " Move by character cnoremap cnoremap " Delete by character cnoremap cnoremap " Move by word cnoremap cnoremap " Delete left word cnoremap " Jump to end of line cnoremap cnoremap " Open cmdline history cnoremap i " Open cmdline history from Normal nnoremap ; : nnoremap : q:i " Windows and buffers ==================================== " Move to mark nnoremap ' ` "nnoremap ` ' " Switch buffers nnoremap n :bnext nnoremap N :bprevious " Window control with leader nnoremap w " Quick window switching nnoremap h h nnoremap j j nnoremap k k nnoremap l l " Window movement nnoremap h H nnoremap j J nnoremap k K nnoremap l L " Window resizing " < increases, > decreases nnoremap , 10> nnoremap . 10< " Vertical resizing nnoremap , 10+ nnoremap . 10- " Set interior window width to 80 columns nnoremap = :vertical resize 84 " Show full file path nnoremap 1 " Change cwd to current buffer's nnoremap gf :cd %:p:h:pwd " Change to project root of file nnoremap gr :cd %:p:h:Rooter:pwd " Editing remaps ======================================== " Uppercase previous word from Insert mode inoremap vbU`>a " Digraph insertion inoremap snoremap i xnoremap c " Autocompletion - word and line inoremap "inoremap " Yank to clipboard nnoremap Y "+y vnoremap Y "+y " Convenient macro replays nnoremap @ q nnoremap q @ " Extended options ====================================== " These use o as a prefix " Enable spellcheck nnoremap ospell :set spell! command! Spell :set spell! " Copy current visual selection to ix.io vnoremap oix :w !ix.sh & command! Ix :w !ix.sh & " Open first URL on line nnoremap ourl :silent call OpenURL() command! Url :silent call OpenURL() " Create a pretty block comment. Supports 3 types of comments command! Prettypy :call PrettySectionComment('#') command! Prettyhtml :call PrettySectionComment("