Command Mode
•Command mode is the mode you are in when you start (default mode)
•Command mode is the mode in which commands are given to move around
in the file, to make changes, and to leave the file
Insert (or Text) Mode
•The mode in which text is created. (You must press <enter> at the
end of each line unless you've set wrap margin.)
•There is more than one way to get into insert mode but only one way
to leave: return to command mode by pressing <Esc>
To be in command mode: Esc
ZZ Write (if there were changes), then quit
:wq Write, then quit
:q Quit (will only work if file has not been changed)
:q! Quit without saving changes to file
You must press <enter> after commands that begin with a : (colon)
From Command Mode
i Insert text before current character
a Append text after current character
I Begin text insertion at the beginning of a line
A Append text at end of a line
o Open a new line below current line
O Open a new line above current line
u Undo last single change
U Restore current line
To cut-and-paste or copy-and-paste:
[Link] the cursor at the beginning of the text you want to cut/copy.
[Link] v to begin character-based visual selection, or V to select whole lines,
or Ctrl-v or Ctrl-q to select a block.
[Link] the cursor to the end of the text to be cut/copied. While selecting text,
you can perform searches and other advanced movement.
[Link] d (delete) to cut, or y (yank) to copy.
[Link] the cursor to the desired paste location.
[Link] p to paste after the cursor, or P to paste before.
Visual selection (steps 1-3) can be performed using a mouse.