Getting Started·Lesson 1

Intro to Modes

modes

The first idea to get comfortable with is modes. The same key does different things depending on which mode you are in.

Normal mode

This is home base. Keys are commands here, not text. You use it to:

  • move the cursor around
  • delete, change and copy text
  • combine small commands into bigger edits
1const total = price * quantity;
2if (total > limit) {
3 notify("over budget", total);
4}
NORMAL1:1

Pressing keys in normal mode moves the cursor; nothing gets typed.

Insert mode

This is the mode you already know from other editors: what you type goes into the file. Press i to enter it and Esc to go back to normal mode.

1const total = price * quantity;
2if (total > limit) {
3 notify("over budget", total);
4}
NORMAL1:7

`i` starts inserting, `Esc` returns to normal mode.

Try it out

1const total = price * quantity;
2if (total > limit) {
3 notify("over budget", total);
4}
NORMAL1:1
Next: Basic Movement

# Why have modes at all?

Because when letters aren't busy typing text, every key on the keyboard can be a command. That's how Vim edits so much with so few keystrokes.