vi filename |
start up vi (if the file doesn't exist it creates it)
|
i |
insert text before the cursor (go into insert mode)
|
a |
append text after the cursor (go into insert mode)
|
backspace/delete |
"un-type" the last character in insert mode
|
ESC |
go back to command mode
|
arrow keys |
cursor movement (or
h /j /k /l )
|
x |
delete character under cursor
|
dd |
delete entire line cursor is on
|
J |
join next line to this line (delete newline)
|
u |
undo the last change (use Control-r or another u to
remake the change, depending on version)
|
ZZ |
write and quit (also :wq)
|
:w |
intermediate write (does not quit vi)
|
:q |
quit (but only works if there are no unsaved changes)
|
:q! |
quit, throw away any changes since the last save
|