Vi Editor

Note: Now I’m using nano. I prefer it a lot over vi(m). Instead of modes, it’s an editor with “normal” controls.

Vi(m) is controlled in modes. After opening a file, you are in view-mode. To edit it, you will have to switch to a different mode. Etc.

vi filename        Open file filename
:wq                Save Changes and Quit
:q!                Quit Without Saving
[esc]              Go Into Command Mode

i        insert before cursor
a        append after cursor
A        append at end of line
r        replace character under cursor with next character typed
R        keep replacing character until [esc] is hit
x        delete character under cursor
dd       delete line under cursor
P        bring back deleted text
yy       copy line
P        paste copied line
/        find
?        find (backwards)
;        repeat last search
:w       save
:#       goto line #
:$       goto end of file

This is a list of the (most) important keys and commands.
For a more complete list, see my source.