Skip to content

Instantly share code, notes, and snippets.

@kevbuchanan
Last active August 3, 2017 08:44
Show Gist options
  • Select an option

  • Save kevbuchanan/7885703 to your computer and use it in GitHub Desktop.

Select an option

Save kevbuchanan/7885703 to your computer and use it in GitHub Desktop.
Vim Cheatsheet

#Vim Cheatsheet (with NerdTree)

Navigation

up, down, left, right - k, j, h, l

go to line - : , line number, enter

Files

While in nerdtree new - m, a, title, enter

delete - m, d, y, enter

move - m, m, path

copy - m, c, path

open in new pane - choose file, s

change pane - control + w, direction

Insert

before cursor - i

after cursor - a

after line - o

before line - shift o

insert before multiple lines (commenting) - control + v, select up or down, shift + i, character, control + [

replace word - ciw

replace between quotes - ci"

replace between parens - ci(

Save

exit insert mode - control + [ or esc

save - :w, enter

quit - :q, enter

Copy/Cut/Paste

exit insert mode - control + [ or esc

select line - v, $

custom selection - v, directions

select to end of file - v, shift g

select line by line - shift, v, up or down

copy - y

copy line - yd

cut - d

cut line - dd

paste - p

move current line to after line number - :, m, line number, enter

move lines to after line number = :, starting line, , ,ending line, m, destination line, enter eg. :10,12m5

Search

search file - /, pattern

search for work under curser - *

search and replace - %s/find/replace/g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment