Modes in Detail
Normal Mode
Default mode. You start here. Keys execute commands — moving the cursor, deleting text, copying, pasting, etc.
- Press
EscorCtrl-[to return to Normal mode from any other mode. - This is where you spend most of your time (counterintuitively).
Insert Mode
Typing text. Behaves like a conventional editor.
Enter Insert mode with:
| Key | Action |
|---|---|
i | Insert before cursor |
I | Insert at beginning of line |
a | Append after cursor |
A | Append at end of line |
o | Open new line below |
O | Open new line above |
s | Delete character and insert |
S | Delete line and insert |
C | Delete to end of line and insert |
Visual Mode
Selecting text. Similar to selecting with a mouse, but with keyboard precision.
| Key | Action |
|---|---|
v | Character-wise visual selection |
V | Line-wise visual selection |
Ctrl-v | Block-wise visual selection (column selection) |
Once text is selected, you can operate on it: d to delete, y to yank (copy), > to indent, etc.
Command-Line Mode
Ex commands. Press : from Normal mode to enter the command line at the bottom of the screen.
Examples:
:w— write (save) the file:q— quit:wqor:x— save and quit:q!— quit without saving:%s/old/new/g— replace all occurrences
Replace Mode
Like Insert mode, but each typed character overwrites the existing character. Enter with R from Normal mode.