Vim
Shortcuts for Vim mode
This is not a complete list
Mode changing
Shortcut | Description |
---|---|
Escape | Enter command mode |
i | Enter insert mode before cursor |
I | Enter insert mode at the beginning of the line |
a | Enter insert mode after the cursor |
A | Enter insert mode at the end of the line |
o | Enter insert mode after the current line |
O | Enter insert mode before the current line |
: | Last line mode (prompt) |
Ctrl c | Exit insert mode and abort current command |
v | Enter visual mode |
V | Enter visual line mode |
Ctrl v | Enter visual block mode |
s | Delete character and enter insert mode |
S | Delete line and enter insert mode |
R | Enter replace mode |
Cursor movement
Shortcut | Description |
---|---|
h/j/k/l | Move cursor left/down/up/right |
0 | Move cursor to beginning of line |
$ | Move cursor to end of line |
^ | Move cursor to first non-empty character of line |
w | Move cursor forward one word |
W | Move cursor forward one word, based on whitespace |
6 w | Move cursor forward 6 words |
b | Move cursor backward one word |
B | Move cursor backward one word, based on whitespace |
6 b | Move cursor backward 6 words |
e | Move cursor to end of word |
ge | Move cursor backward one word, to end of word |
6 e | Move cursor forward 6 words, to end of word |
f c | Move cursor forward to next character c |
F c | Move cursor backward to previous character c |
t c | Move cursor to before next character c |
T c | Move cursor to after previous character c |
; | Repeat previous t or f movement, forward |
, | Repeat previous t or f movement, backward |
Ctrl b/f | Move cursor one page up/down |
Ctrl u/d | Move cursor half a page up/down |
H | Move cursor to top of visible screen |
M | Move cursor to middle of visible screen |
L | Move cursor to bottom of visible screen |
gg | Move cursor to beginning of document |
G | Move cursor to end of document |
16 G | Move cursor to line 16 |
zt | Scroll current line to top of screen |
zz | Scroll current line to center of screen |
zb | Scroll current line to bottom of screen |
Ctrl e | Scroll screen down one line |
Ctrl y | Scroll 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 o | Move cursor to back (in location history) |
Ctrl i | Move cursor to forward (in location history) |
Editing
Shortcut | Description |
---|---|
x | Delete character |
r | Replace character |
dd | Cut line |
yy | Yank line |
p | Paste |
P | Paste before |
u | Undo |
Ctrl r | Redo |
~ | Toggle case |
gU | Uppercase |
gu | Lowercase |
gUU | Uppercase current line |
guu | Lowercase current line |
> | Indent |
< | Unindent |
d/x | Delete selection |
s | Replace selection |
y | Yank selection |
zc | Fold current section |
zo | Unfold current section |
za | Toggle current section folding |
zC | Fold all sections |
zO | Unfold all sections |
Macros
Shortcut | Description |
---|---|
q c | Record macro named c |
q | (While recording) stop recording |
@ c | Execute macro named c |
@ 6 c | Execute macro named c 6 times |
@@ | Execute macro again |
Tables
Shortcut | Description |
---|---|
\tt | Generate table from header |
\tr | Reformat table |
\tdd | Delete row |
\tdc | Delete column |
\tic | Insert column (after) |
\tiC | Insert column (before) |
\ts | Sort table |
Other table commands:
Command | Description |
---|---|
Tableize | Generate table from header |
TableModeRealign | Reformat table |
TableSort | Sort by current column (ascending) |
TableSort! | Sort by current column (descending) |