Vim is a modal editor. In normal mode keys are commands (move, delete,
change); in insert mode they type text. You start in normal mode, and
<Esc> always takes you back to it.
Turn Vim on in Settings (or the editor's status bar), then practise in the
Playground. The status bar shows the current mode; Ctrl+/ opens the cheat
sheet, and the coach suggests shorter keys as you go.
Moving
h/l move one character left/right, j/k one line down/up (keeping the column).Counts multiply: 5j moves five lines down.
Inserting
| Key | Inserts | |
|---|---|---|
i |
before the cursor | |
a |
after the cursor | "append" |
I |
before the first non-blank character | |
A |
at the end of the line | |
o / O |
on a new line below / above |
Type your text, then <Esc>.
Deleting and undoing
xdeletes the character under the cursor (3xdeletes three).uundoes,Ctrl-rredoes.
The habit to build
Stay in normal mode. Go to insert mode only to type, and leave it straight away. The drills count your keystrokes against par: reach par for gold.