Last operation
Use .
to replicate last operation
Move
Key | Description | h | left |
l | right |
j | down |
k | up |
w | next word |
d | prev word |
Insertion
Key | Description | i | insert at current caret |
I | insert to line start |
a | insert after current caret |
A | insert to line end |
o | strart new line after caret |
O | strart new line before caret |
cw | replace from caret to the end of a word |
Save & quit
Key | Description | :q! | force quit without save |
:q | quit |
:wq! | force save and quit |
:w +file name | save |
:saveas +file path | save as |
:x | save and quit |
:wq | save and quit |
Deletion
Key | Description | x | delete char at current caret |
X | delete char before caret |
Delete | same as x |
dd | delete the current line |
dw | delete a word |
d$ or D | delete to line end |
d^ | delete to line start |
dG | delete to document end |
d1G | delete to document start |
Move between lines
Key | Description | nG | move caret to line #n |
gg | move caret to first line |
G | move caret to last line |
Move inside line
Key | Description | w | to next word start |
e | to next word end |
b | to prev word start |
ge | to prev word end |
0 or ^ | to line start |
$ | to line end |
f+letter | find letter backward and move to the first match position |
F+letter | find letter forward and move to the first match position |
t+letter | find letter backward and move to a letter before the first match position |
T+letter | find letter forward and move to a letter before the first match position |
Copy and paste
Key | Description | y | copy |
yy | copy current line |
y^ | copy to line start |
y$ | copy to line end |
yw | copy word |
y2w | copy 2 words |
yG | copy to ducument end |
y1G | copy to document start |
p | paste after caret |
P | paste before caret |
Replace and undo
Key | Description | r +letter | replace caret letter to specific letter |
R | replace continuously until Esc press |
cc | replace current line |
cw | replace a word |
C | replace from caret to line end |
~ | toggole case of current letter |
u{n} | undo n time |
U | undo all changes of current line |
Ctrl+r | redo, undo an undo |
Indent
Key | Description | >> | increase indent |
<< | decrease indent |
:set shiftWidth? | how many space |
:set shiftWidth=8 | set 8 spaces of each indent |
Alignment
Key | Description | :ce | center align |
:ri | right align |
:le | left align |