Vi command summary

From ezUnix
Jump to: navigation, search

Vi Command Summary


vi filename

Enter edit mode

i	-edit at curser.
a	-edit after curser.
I	-edit at beginning of line.
A	-edit at end of line.
o	-edit at new line below.
O	-edit at new line above.
cw	-replace word.
C	-replace line.

Navigation commands

ESCAPE : 13	-jump to line 13.
h		-move curser left.
l		-move curser right.
k		-move curser up.
j		-move curser down.
0		-move to start of line.
$		-move to end of line.
w		-forward one word.
b		-back one word.
H		-go to top of screen.
L		-go to bottom of screen.
G		-move to end of file.

Write buffer to file

ESCAPE : w	-write to file.
ESCAPE : wq	-write to file and quit.

Cut and paste

yy		-copy line.
dd		-cut line.
p		-paste line.

Misc commands

u		-undo last edit.
/expression	-search for expression.