" *** *** *** Key Mappings *** *** *** " ************************************ " Quick toggle between buffers noremap j :b# " Add semicolon or comma to the end of the line nnoremap ;; A; nnoremap ,, A, " Maintain the cursor position when yanking a visual selection vnoremap y myy`y vnoremap Y myY`y " Delete last character of line nnoremap x $x " Open vim config in a new buffer, reload vim config nnoremap ve :e $MYVIMRC nnoremap vr :source $MYVIMRC " Delete current buffer nnoremap X :bd " Delete all buffers nnoremap da :bufdo bdelete " Save current buffer nnoremap sf :w " Allow gf to open non-existent files map gf :edit " Reselect visual selection after indenting vnoremap < >gv " Set spell checker to `s` " zg (good), zG (good temp), zw (wrong), zW (wrong temp) nnoremap s :set spell! " Switch off highlighting nnoremap h :nohlsearch " Toogle list nnoremap l :set list! " Indent the whole source code nnoremap ff gg=G'' " Reverse the mark mapping nnoremap ' ` nnoremap ` ' " Visuall select of just pasted content nnoremap gp `[v`] nnoremap gy `[v`]y " When text is wrapped, move by terminal rows, not lines, unless a count is provided noremap j (v:count == 0 ? 'gj' : 'j') noremap k (v:count == 0 ? 'gk' : 'k') " Open a quickfix window for the last search nnoremap ? :execute 'vimgrep /'.@/.'/g %':copen " Faster linewise scrolling noremap 3 noremap 3 " Keep the window centered noremap G Gzzzv noremap n nzzzv noremap N Nzzzv noremap } }zzzv noremap { {zzzv " Close all buffers nnoremap XX :qa " Add lines in NORMAL Mode nnoremap gn ok nnoremap gN Oj " Change to the folder of the current file nnoremap cf :cd %:p:h:pwd " Quickfix Window nnoremap qo :copen nnoremap qc :cclose " Exit INSERT MODE with 'jk' inoremap jj " Reformat a line into a block nnoremap q gqip " Reformat a block into a line nnoremap qq vipJ " Easier split navigation nnoremap nnoremap nnoremap nnoremap