##### How to read this doc? # :something<enter> # A ':' means press :-key, semicolon, to enter vim command # <enter> # <key> means press that key, once # # For example, to see (n)vim help :help<enter> # <gt> # < many keys > means, press those keys (no <>, semicolon or enter) #### Navigate file (buffer) # # Jump to line 17 :17<enter> # Jump 7 lines down :+7 # Jump 8 lines up file :-8 # Search 'foo' /foo<enter> # Next search match <n> # Previous search match <N> # Search delimiter pair (eg. '<' and '>', or '{' and '}' % # Clear search highlight (until next search) :noh<enter> ##### Using tabs # # Open file in new tab :tabe .<enter> # Next tab (right) <gt> # Previous tab (left) <gT> ##### Navigate buffers # # list buffers :ls<enter> # edit buffer 4 :b 4<enter> # next buffer :bn # delete buffer (don't forget to save) :bd ##### Split tabs # # Vertical split :vspl # horizontan split :split # jump between splits (hit 'w' twice) <ctrl+ww> ##### Netrw - Nvim file explorer # # Open file explorer in a split :Vex<enter> # Open file to previous window (from Netrw win) P # Open file to new split v #### Search and replace # # % = every line, s = substitute, /foo// search word, //bar replace word, g = globally :%s/foo/bar/g ##### Vim line cleanup ops # # Remove windows line feeds nn <Leader>M <ESC>:%s/<C-V><C-M>//g<CR> # Remove line ending whitespace nn <Leader>S <ESC>:silent! %s/\s\+$//g<CR> # Remove empty lines nn <Leader>X <ESC>:%g/^[[:space:]]*[[:cntrl:]]*$/d<CR> nn <Leader>] :set number! \| echom "Number: " . &number<CR> nn <Leader>[ :set paste! \| echom "Paste: " . &paste<CR> nn <Leader>t <ESC>:%s/\t/ /g<CR>