Key reference
Every binding, by mode. :help inside the editor prints a one-line version of this.
Normal mode
Motions
| Key |
|
h j k l |
left, down, up, right |
| ← ↓ ↑ → |
the same |
w b e |
word forwards, back, to the end of one |
W B E |
the same, punctuation counted as part of the word |
0 |
the first column |
^ |
the first non-blank |
$ |
the end of the line |
+ Enter-ish - |
first non-blank of the next line, of the previous |
| Space |
forward one character |
_ |
the first non-blank of this line |
gg G |
the first line, the last |
{ } |
back and forward a paragraph |
fc Fc |
to the next c on this line, or the previous |
tc Tc |
to just before it, either way |
% |
to the bracket matching the next one on this line |
`a 'a |
to mark a: the character, or the line's first non-blank |
| Key |
|
| Ctrl+F Ctrl+B |
forward, back a screenful |
| PgDn PgUp |
the same |
| Ctrl+D Ctrl+U |
half a screenful |
| Ctrl+E Ctrl+Y |
move the view, not the cursor |
Operators
| Key |
|
d c y |
delete, change, yank |
> < |
indent, outdent |
dd cc yy >> << |
the same, on the whole line |
Each takes a count on either side and a motion or text object after: d2w, 2dw, ci", y}.
Text objects
| Key |
|
iw aw iW aW |
a word, inner or around |
i( a( i) a) ib ab |
parentheses |
i{ a{ i} a} iB aB |
braces |
i[ a[ i] a] |
brackets |
i" a" i' a' |
i` a` |
Single-key edits
| Key |
|
x X |
delete the character under the cursor, or before it |
D C |
delete, change to the end of the line |
s S |
substitute the character, the line |
rc |
replace the character with c |
~ |
swap its case |
J |
join the next line on |
p P |
put after the cursor, before it |
o O |
open a line below, above |
Entering insert mode
| Key |
|
i I |
before the cursor, before the first non-blank |
a A |
after the cursor, at the end of the line |
o O |
on a new line below, above |
Undo, repeat, macros, marks
| Key |
|
u |
undo |
| Ctrl+R |
redo |
. |
repeat the last change |
qa … q |
record keystrokes into register a |
@a |
play them; 3@a three times |
@@ |
play the last one again |
ma |
put mark a here |
`a 'a |
go to it |
`` |
back to where the last jump started |
Registers
| Key |
|
"x |
send the next command's text to register x |
"+y "+p |
the system clipboard; "* is the same |
Visual mode
| Key |
|
v |
select characters |
V |
select lines |
| Esc |
stop |
Any motion extends the selection; any operator applies to it.
Files, windows and search
| Key |
|
/ ? |
search forwards, backwards |
n N |
the next match, the previous |
| Ctrl+P |
the fuzzy file picker |
| Ctrl+G |
find in project |
Ctrl+W then w |
the next window |
Ctrl+W then h j k l |
the window left, down, up, right |
Ctrl+W then s v |
split horizontally, vertically |
Ctrl+W then c q |
close this window |
Ctrl+W then o |
close every other one |
ZZ |
write and quit |
: |
the command line |
| Ctrl+C |
says type :q to exit; it does not quit |
Insert mode
| Key |
|
| Esc |
back to normal mode |
| Enter |
split the line |
| Backspace |
delete backwards |
| Tab |
insert what the file indents with (see settings) |
| ← ↓ ↑ → |
move without leaving insert mode |
There are no other commands in insert mode: everything else you press is text.
The command line
| Key |
|
| Enter |
run it |
| Esc |
abandon it |
| Backspace |
delete backwards; on an empty line, abandon |
The find dialog
| Key |
|
| ↑ ↓ |
move through the hits |
| PgUp PgDn |
a windowful at a time |
| Enter |
open the hit, fill the quickfix list |
| Esc |
close |
| Ctrl+A |
ignore case |
| Ctrl+W |
whole words |
| Ctrl+R |
regular expression, on by default |
The quickfix pane
| Key |
|
| Enter |
go to the entry under the cursor |
Everything else is an ordinary buffer, so the motions all work.