By no means comprehensive, but enough to get you by.
Key commands
command | action |
[ESC] | Exit a mode or cancel a compound command |
i | Enter insert mode |
r | Enter replace mode |
: | Enter command line mode (see below for command line commands) |
dd | Delete a line |
yy | Copy a line |
P | Paste a previously copied/deleted line |
J | Join current line with next line |
u | Undo last command |
[CTRL] R | Redo last command |
on the vi command line
command line | action |
q | Quit |
q! | Really quit |
x | Save and quit |
x! | Really save and quit (for read-only files) |
g/pattern1/s//pattern2/g | Global replace pattern1 with pattern2 |
set nu | Turn on line numbers |
set nonu | Turn off line numbers |
set ic | Set searching to be case insensitive |
Searching
/regular exp | Do a regular expression search |
:set ic | Set searching to be case insensitive |