Escape: Groking Modal Editing
Every editor you’ve used has a single mode: Insert mode.
And in Insert mode, you have a well known cursor.
It’sutomatically switched a tall, slender, and it probably blinks.
This tall-skinny-blinky cursor dutifully inserts every character you type.
But there’s a catch.
Commands — like Save
, Copy
, Paste
, and Undor
— require the use of modifier keys.
Vim has two modes
Unlike other editors, Vim has two major modes: Insert mode
and Normal mode
.
Insert mode
is the mode you’re familiar with.
Normal mode
can be thought of as a “command mode”.
Using your editor’s Vim mode (or extension), you can escape insert mode by tying esc.
How to switch from Insert mode to Normal mode
We access this mode with the Esc key.
Hitting Esc
you enter what Vim calls “Normal mode”.
And in this mode, every key becomes a mneumonic command.
Escaping Insert mode
Hit Esc now to enter Normal mode.
Depending on the editor you’re using, you may see the cursor change to a rectangle.
Or, if you see a activity bar, you may see the mode change from --INSERT--
to nothing at all.
These are all signs that you are now in Normal mode.
Re-entering Insert mode
Now, just as important as leaving Normal mode, is re-entering Insert mode.
For now use the i key to re-enter Insert mode. This is the easiest to remember because it’s a mneumonic for “insert”.
Take a moment to escape and re-enter Insert mode.
The many ways to enter Insert mode
Key | Description |
---|---|
i | Insert (before the cursor) |
a | Append (after the cursor) |
o | Open a new new line (below the cursor) |
s | Substitute the character under the cursor |
There are also capital letter variants. I’ll use ⇧ to represent the shift key here (and throughout) to avoid confusion with lowercase commands.
Key | Description |
---|---|
⇧i | Insert at the beginning of the line |
⇧a | Append at the end of the line |
⇧o | Open a new line above the cursor |
⇧s | Substitute the the line under the cursor |
Assignment
Navigate a document and try escaping and re-entering Insert mode several times. Use as many of these insert methods as you can think of.