Exiting

Navigating

h j k l # move one character
<C-U> / <C-D> # move half page
<C-F> / <C-B> # move one page
b / w # previous / next word
e / ge # previous / next end of word
0 # start of line
^ # start of line (after whitespace)$ # end of line
gg # first line
G # Last line
:n # to line n
nG # to line n
zz # center this line
H # move to top of screen
M # move to middle of screen
L # move to bottom of screen

Editing

a # append
A # append on tail
i # insert
I # insert on head
o # next line
O # previous line
s # delete char and insert
S # delete line and insert
C # delete until end of line and insert
r # replace one character
R # enter Replace mode

Tab

vim -p file1 file2 file3 # open in tabs
:tabe[dit] {file}# edit specified file in a new tab
:tabc[lose] # close current tab
:tabc[lose] {i}# close i-th tab
:tabo[nly] # close all other tabs (show only the current tab)
:tabn # go to next tab
:tabp # go to previous tab
:tabfirst # go to first tab
:tablast # go to last tab
gt # go to next tab
gT # go to previous tab{i}gt # go to tab in position i

Other

When writing in insert mode, it’s possible to paste a register at the current location without leaving insert mode. To do this, press CTRL-R then type the name of a register. For example, CTRL-R a will insert the contents of a.

Nerdtree

?: toggle help# File
o: open in prev window
go: preview
t: open in new tab
T: open in new tab silently
i: open split
gi: preview split
# Directory
o: open & close node
O: recursively open node
t: open in new tab
T: open in new tab silently
x: close parent of node
X: close all child nodes of current node recursively
# Filesystem
u: move tree root up a dir
U: move tree root up a dir but leave old root open
r: refresh cursor dir
R: refresh current root
m: Show menu
# Tree navigation
P: go to root
p: go to parent
K: go to first child
J: go to last child
# Other
q: Close the NERDTree window
A: Zoom (maximize-minimize)