Vim
2024-07-14
1. Simulating Vim on the Page
ctrl
-s
is a common convention for representing chordal commands. It means
"Press the Control key and the s
key at the same time." But this convention
isn’t well suited to describing Vim’s modal command set.
1.1. Playing Melodies
In Normal mode, we compose commands by typing one or more keystrokes in sequence. There commands appear as follows:
Notation | Meaning |
---|---|
|
Press |
|
In sequence, pres |
|
In sequence, pres |
Most of these sequences involve two or three keystrokes, but some are longer. Deciphering the meaning of Vim’s Normal mode command sequences can be challenging, but you’ll get better at it with practice.
1.2. Playing Chords
When you see a keystroke such as <C-p>
, it doesn’t mean "Press <
, then C
,
then -
, and so on." The <C-p>
notation is equivalent to Ctrl
-p
, which
means "Press the Ctrl
and p
keys at the same time"
Some of Vim’s commands are formed by combining chords and keystrokes in
sequence, and this notation handles them well. Consider these examples:
Notation | Meaning |
---|---|
|
Press |
|
Press |
|
Press |
|
Press |
1.3. Placeholders
Some commands must be followed by a particular kind of keystroke, while other command can be followed by any key on the keyboard. I use curly braces to denote the set of valid keystrokes that can follow a command.
Here are some examples:
Notation | Meaning |
---|---|
|
Press |
|
Press |
|
Press |
|
Press |
|
Press |
1.4. Showing Special Keys
Some keys are called by name. This table shows a selection of them:
Notation | Meaning |
---|---|
|
Press the Escape key |
|
Press the carriage return key (aka |
|
Press the Control key |
|
Press the Tab key |
|
Press the Shift key |
|
Press the |
|
Press the up-arrow key |
|
Press the down-arrow key |
|
Press the space bar |
Note that the space bar is represented as
. This could be combined with the
f{char}
command to form f
.