Vi Commands
+ Down 1 line (also RETURN and DOWN)
- Up 1 line (also UP)
h Backward 1 character (also LEFT)
j Forward 1 line
k Backward 1 line
l Forward 1 character (also SPACE and RIGHT)
[Numbers before the above commands repeat them that many times]
0 (Zero)Goes to beginning of line
$ Goes to end of line
G Goto end of file
Ctrl-F Forward 1 page
Ctrl-B Backward 1 page
Ctrl-L Clear and redraw
Ctrl-R Retype, eliminate @ lines
Ctrl-G Prints information about file on bottom line
i Changes to insert mode, insert before character
a Changes to insert mode, appends (inserts after character)
A Append at end of line
o Inserts 1 line below cursor, changes to insert mode
O Inserts 1 line before cursor, changes to insert mode
rx Replaces character under cusor with x
R Overstrike mode, changes to insert mode (so to speak)
J Joins lines
Ctrl-[ Returns to Command mode
ESC Returns to Command mode (Note that in Unix ESC is Ctrl-[)
dd Deletes line under cursor
nd Deletes (n + 1) lines
D Deletes from cursor to end of line
x Deletes character under cursor
nx Deletes n characters (maybe n + 1; haven't checked)
u Undoes last action
yy Yanks current line into buffer
ny Yanks (n + 1) lines into buffer
p Puts lines from buffer after current line
P Puts lines from buffer before current line
Works with both 'd' and 'y'.
ZZ Saves and exits (untested by me)
[Commands with numerical arguments may require a ]
/string Searches for "string" after cursor. Wraps to beginning if no
matches
?string Searches for "string" before cursor. Wraps to end if no matches
% Finds matching (){ or }
:nnn Goto line nnn
:q Quits, doesn't save
:q! Quits, not saving changes
:w file Writes buffer to "file"
:w! file Writes buffer to "file" regardless of errors that might occur.
:r file Reads "file" into buffer, inserting after current line
:x Saves and exits