-
Normal
Startup mode. Normal mode can transition to all the other modes and vice versa (so going through normal - is the only (consistent) way to switch between any other 2 modes -
Esc(enter from any other mode)
-
Command
:enter commands
-
Insert
i: type/edit - the usual editor experience
-
Visual (Select)
-
Vvisual line (whole lines) -
vvisual -
Ctrl + vvisual blockVisual mode is the (only) way you can select text. As a bonus the selected text gets visually highlighted (so selction mode would be a more accurate name). After text is selected you can apply operations to the selected text (eg
y,d,>,<see below)
-
i - Insert mode
o- line break after current and Insert modeO- line break before current and Insert mode
: - Command mode
V visual line (whole lines)
v visual
Ctrl + v visual block
q -start/stop recording
(beware accidental - hit again to toggle)
- yank
y- yank (ie copy to register) selectionyy- yank current line
- delete
d- delete selection (cut)dd- delete linex- delete (char after cursor)X- backspace (delete char before cursor)
- paste
P- paste (from prev yank - ie register) on current linep- ..... on next lineCmd/Ctrl + V- paste clipboard (os)
- undo
u- undoctrl-r- redo
- indent selection
>- in<- out
0 - start of line
$ - end of line
w - forward word
b - backward word
Ctrl+u - 1/2 page Up
Ctrl+d - 1/2 page Down
Ctrl+b - page Up
Ctrl+f - page Down
gg - first line
G - last line
- select all
gg,V,G- (move to first line, enter visual line mode, move to last line)
:w - write file
:r - read file
:q - quit (after saving)
:q! - quit without saving
Esc- normal mode
:set number - toggle line numbers on
:set nonumber - toggle line numbers off
