vi Command Reference

http://users.binary.net/dturley/vi.html
(2003-11-12)

This list was hastily put together for my own use.

Perhaps you'll find it useful as well.

Input mode: set insertion point [back to top]
iinsert text at cursor
aappend text after cursor
Iinsert text at beginning of time
Aappend text at end of line
oopen line below cursor
Oopen line above cursor
Deletion and Change: delete/change words or character [back to top]
dwdelete a single word
cwchange a word
dddelete entire line
R replace line
D delete from curosor position to end of line
C change from cursor position eo end of line
x delete a single character
r replace a character
Cursor movement: position the cursor [back to top]
l move right
h move left
j move down
k move up
$ move to end of line
^ move to beginning of line
w move to next word
e move to end of word
1Gmove to first line
nGmove to line n
Gmove to last line
Screen movement: move a screen at a time [back to top]
ctrl-dscroll forward half a screen
ctrl-uscroll back half a screen
ctrl-fmove to next screen
ctrl-bmove to previous screen
ctrl-lredraw screen
Last line mode: used when ending an editing session [back to top]
:w write buffer
:q quit
:q! force quit without saving
:wq write and quit (save)
:n next file
:r read file
:e edit file
:f file name
:set file name
:set noset options off
:! escape to shell
:n go to line n
Miscellaneous [back to top]
u undo last action
/ search forward
? search back
N search back (alternate)
n repeat search
. repeat last command
yy yank line
p put below cursor
P put above cursor
ZZ write and quit