Tabs
Open a new tab
:tabnew
Open file in a new tab
:tabe <file>
Switch to tab on Right
<ctrl> PgUp
Switch to tab on Left
<ctrl> PgDn
Run command in all tabs
:tabdo <command>
Panes
Split window/pane vertically
:vnew
Split window/pane horizontally
:new
Switch to pane to the left
<ctrl> w + h
Switch to pane below
<ctrl> w + j
Switch to pane above
<ctrl> w + k
Switch to pane on the right
<ctrl> w + l
Give all vertical space to current pane
<ctrl> w + _
Give all horizontal space to current pane
<ctrl> w + |
Evenly distribute space for all panes
<ctrl> w + =
Increase current pane height
<ctrl> w + +
Decrease current pane height
<ctrl> w + -
Increase current pane width
<ctrl> w + >
Decrease current pane width
<ctrl> w + <
File
Open file
:e <file>
New file
:enew
Save current file
:w
Save current file as filename
:w <file>
Save and quit
:wq
Save and quit
:x
Quit
:q
Force quit
:q!
Delete/close buffer
:bd
Print file
:hardcopy
Location
Show current position in file
<ctrl> G
Show line numbers
:f
Place mark [a-zA-Z] at cursor
m[a-zA-Z]
Goto mark [a-zA-Z]
`[a-zA-Z]
Show all marks
:marks
Cut/Copy/Paste/Modify
Cut/Delete
Delete current line
dd
Delete # lines
#dd
Delete current word
dw
Delete to end of line
d$
Delete to beginning of line
d^
Delete character under cursor
x
Delete character under cursor then enter insert mode
s
Delete character before cursor
X
Delete from line # to &
:#,&d
Delete line into register [a-z0-9]
"[a-z0-9]dd
Delete line into host clipboard
"+dd
Copy/Yank
Yank current line
yy
Yank # lines
#yy
Yank current word
yw
Yank to end of line
y$
Yank to beginning of line
y^
Yank from line # to &
:#,&y
Yank line into register [a-z0-9]
"[a-z0-9]yy
Yank line into host clipboard
"+yy
Paste/Put
Put current register at cursor
p
Put current register before cursor
P
Put register [a-z0-9] at cursor
"[a-z0-9]p
Put text from clipboard at cursor
"+p
Put current register WRT indent
]p
Modify
Switch case of word to CAPS
gUw
Switch case of word to lower
guw
Switch case of character under cursor
~
Invert case on word
g~w
Replace character under cursor with #
r#
Replace from cursor to end of word
ce
Replace from cursor to end of line
c$
Replace # words
c#w
Replace between double quote pair
ci"
Replace between single quote pair
ci'
Replace between ( ) pair
ci)
Replace between [ ] pair
ci]
Replace between { } pair
ci}
Replace between < > pair
ci>
Replace between XML/HTML tag pair
cit
Increment number under cursor
<ctrl> a
Decrement number under cursor
<ctrl> x
Indent entire line
>>
Unindent entire line
<<
Autoindent entire line
==
View contents of registers
:reg
Text Insertion
Insert text before cursor
i
Insert text at beginning of line
I
Start overtype mode
R
Insert text after cursor
a
Insert text at end of line
A
Open new line following current line
o
Open new line before current line
O
Switch to visual selection mode
v
Switch to visual line selection mode
V
Switch to visual block selection mode
<ctrl> V
Movement
Move cursor left
h
Move cursor down
j
Move cursor up
k
Move cursor right
l
Move cursor up one display line
gk
Move cursor down one display line
gj
Move cursor to top of display
H
Move cursor to middle of display
M
Move cursor to bottom of display
L
Move cursor forward to start of next word
w
Move cursor to end of next word
e
Move cursor backward one word
b
Move cursor forward one sentence
)
Move cursor backward one sentence
(
Move cursor to start of line
0
Move cursor to first character of line
^
Move cursor to end of line
$
Move cursor forward one screenful
<ctrl> f
Move cursor backward one screenful
<ctrl> b
Move cursor up half a screenful
<ctrl> u
Move cursor down half a screenful
<ctrl> d
Move cursor to top of file
gg
Move cursor to bottom of file
G
Move cursor to line #
#G
Move cursor forward to next character # on line
f#
Move cursor forward to character before the next character # on line
t#
Move cursor backwards character # on line
F#
Macros
Start recording macro into register [a-z0-9]
q[a-z0-9]
End recording of current macro
q
Playback macro from register [a-z0-9]
@[a-z0-9]
Miscellaneous
Undo
u
Restore line
U
Join line below to current line
J
Repeat last command
.
Code Folding
Open Fold
zo
Close Fold
zc
Reduce fold level
zr
Increase fold level
zm
Reduce all folds
zR
Increase all folds
zM
Move to next fold downwards
zj
Move to next fold upward
zk
Delete fold
zd
Delete all folds
zE
Create fold of # lines below cursor
zf#j
Create fold between line # and &
:#,& fold
Create fold of paragraph
zfap
Create fold in { } brackets
zfa}
Create fold in ( ) brackets
zfa)
Create fold in [ ] bracket
zfa]
Create fold in < > brackets
zfa>
Search and Replace
Find # searching forward
/#
Find # searching backwards
?#
Continue search downwards
n
Continue search upwards
N
Move to matching bracket from under cursor
%
Substitute old for new on line with no prompt
:s/old/new/g
Substitute old for new on lines # to & with no prompt
:#,&s/old/new/g
Globally substitute old for new with no prompt
:%s/old/new/g
Globally substitute old for new with prompt
:%s/old/new/gc
External Calls
Execute an external command in the shell
:! <command>
Insert the contents of file at cursor position
:r <file>
Insert output of command at cursor position
:r !<command>