Vim

Shortcuts for Vim mode

This is not a complete list

Mode changing

ShortcutDescription
EscapeEnter command mode
iEnter insert mode before cursor
IEnter insert mode at the beginning of the line
aEnter insert mode after the cursor
AEnter insert mode at the end of the line
oEnter insert mode after the current line
OEnter insert mode before the current line
:Last line mode (prompt)
Ctrl cExit insert mode and abort current command
vEnter visual mode
VEnter visual line mode
Ctrl vEnter visual block mode
sDelete character and enter insert mode
SDelete line and enter insert mode
REnter replace mode

Cursor movement

ShortcutDescription
h/j/k/lMove cursor left/down/up/right
0Move cursor to beginning of line
$Move cursor to end of line
^Move cursor to first non-empty character of line
wMove cursor forward one word
WMove cursor forward one word, based on whitespace
6 wMove cursor forward 6 words
bMove cursor backward one word
BMove cursor backward one word, based on whitespace
6 bMove cursor backward 6 words
eMove cursor to end of word
geMove cursor backward one word, to end of word
6 eMove cursor forward 6 words, to end of word
f cMove cursor forward to next character c
F cMove cursor backward to previous character c
t cMove cursor to before next character c
T cMove cursor to after previous character c
;Repeat previous t or f movement, forward
,Repeat previous t or f movement, backward
Ctrl b/fMove cursor one page up/down
Ctrl u/dMove cursor half a page up/down
HMove cursor to top of visible screen
MMove cursor to middle of visible screen
LMove cursor to bottom of visible screen
ggMove cursor to beginning of document
GMove cursor to end of document
16 GMove cursor to line 16
ztScroll current line to top of screen
zzScroll current line to center of screen
zbScroll current line to bottom of screen
Ctrl eScroll screen down one line
Ctrl yScroll screen up one line
(Move cursor to next sentence
(Move cursor to previous sentence
}Move cursor to next paragraph
{Move cursor to previous paragraph
Ctrl oMove cursor to back (in location history)
Ctrl iMove cursor to forward (in location history)

Editing

ShortcutDescription
xDelete character
rReplace character
ddCut line
yyYank line
pPaste
PPaste before
uUndo
Ctrl rRedo
~Toggle case
gUUppercase
guLowercase
gUUUppercase current line
guuLowercase current line
>Indent
<Unindent
d/xDelete selection
sReplace selection
yYank selection
zcFold current section
zoUnfold current section
zaToggle current section folding
zCFold all sections
zOUnfold all sections

Macros

ShortcutDescription
q cRecord macro named c
q(While recording) stop recording
@ cExecute macro named c
@ 6 cExecute macro named c 6 times
@@Execute macro again

Tables

ShortcutDescription
\ttGenerate table from header
\trReformat table
\tddDelete row
\tdcDelete column
\ticInsert column (after)
\tiCInsert column (before)
\tsSort table

Other table commands:

CommandDescription
TableizeGenerate table from header
TableModeRealignReformat table
TableSortSort by current column (ascending)
TableSort!Sort by current column (descending)