Vim manual

Last operation

Use . to replicate last operation

Move

KeyDescription
hleft
lright
jdown
kup
wnext word
dprev word

Insertion

KeyDescription
iinsert at current caret
Iinsert to line start
ainsert after current caret
Ainsert to line end
ostrart new line after caret
Ostrart new line before caret
cwreplace from caret to the end of a word

Save & quit

KeyDescription
:q!force quit without save
:qquit
:wq!force save and quit
:w +file namesave
:saveas +file pathsave as
:xsave and quit
:wqsave and quit

Deletion

KeyDescription
xdelete char at current caret
Xdelete char before caret
Deletesame as x
dddelete the current line
dwdelete a word
d$ or Ddelete to line end
d^delete to line start
dGdelete to document end
d1Gdelete to document start

Move between lines

KeyDescription
nGmove caret to line #n
ggmove caret to first line
Gmove caret to last line

Move inside line

KeyDescription
wto next word start
eto next word end
bto prev word start
geto prev word end
0 or ^to line start
$to line end
f+letterfind letter backward and move to the first match position
F+letterfind letter forward and move to the first match position
t+letterfind letter backward and move to a letter before the first match position
T+letterfind letter forward and move to a letter before the first match position

Copy and paste

KeyDescription
ycopy
yycopy current line
y^copy to line start
y$copy to line end
ywcopy word
y2wcopy 2 words
yGcopy to ducument end
y1Gcopy to document start
ppaste after caret
Ppaste before caret

Replace and undo

KeyDescription
r +letterreplace caret letter to specific letter
Rreplace continuously until Esc press
ccreplace current line
cwreplace a word
Creplace from caret to line end
~toggole case of current letter
u{n}undo n time
Uundo all changes of current line
Ctrl+rredo, undo an undo

Indent

KeyDescription
>>increase indent
<<decrease indent
:set shiftWidth?how many space
:set shiftWidth=8set 8 spaces of each indent

Alignment

KeyDescription
:cecenter align
:riright align
:leleft align