DaleSchool

The World of Modes

Beginner15min

Learning Objectives

  • Distinguish Normal, Insert, and Command-line modes
  • Enter Insert mode with i, a, and o
  • Return to Normal mode with Esc
  • Identify your current mode from the screen

Working Code

First, create a practice file:

vim modes.txt

Once Vim opens, try the following three steps in order:

Step 1: Enter Insert mode with i

i
This is the first line.

You'll see -- INSERT -- at the bottom of the screen. You can type freely.

Step 2: Return to Normal mode with Esc

Press Esc. -- INSERT -- disappears. In Normal mode, every key is a command.

Step 3: Enter Command-line mode with :

From Normal mode, press : — the cursor jumps to the bottom of the screen. Type wq and press Enter:

:wq

You've now experienced all three modes!

Try It Yourself

Open the file again:

vim modes.txt

Wait, there are several ways to enter Insert mode?

i isn't the only one. Each key starts typing at a different position:

KeyWhere it startsMnemonic
iBefore the cursorinsert
aAfter the cursorappend
oNew line belowopen below
IStart of the lineInsert at start
AEnd of the lineAppend at end
ONew line aboveOpen above

Try them one by one:

  1. From Normal mode, press A — you start typing at the end of the line immediately!
  2. Press Esc, then o — a new line opens below and you're in Insert mode!
  3. Press Esc, then O — a new line opens above.

Get a feel for which one fits your flow best.

"Why?" — Why do we need modes?

Think about driving a car:

GearVim modeWhat it does
Drive (D)InsertType text
Park (P)NormalIssue commands (move, delete, yank)
Reverse (R)Command-lineSystem commands (save, quit, search)

Just as you shift gears while driving, you switch to the mode that matches what you want to do.

In a regular editor, pressing d types the letter d. In Vim's Normal mode, pressing d is a delete command. The same key behaves completely differently depending on the mode. That's how Vim turns every key on your keyboard into a command.

How to check your current mode

Look at the status bar at the bottom of the Vim screen to see your current mode:

IndicatorMode
(nothing)Normal
-- INSERT --Insert
-- VISUAL --Visual (covered later)
: (cursor at bottom)Command-line

When you're unsure, press Esc once or twice. You always return to Normal mode. Esc is your "home base."

Common mistake: typing in the wrong mode

If you start typing without realizing you're in Normal mode, strange things happen:

Say you wanted to type "hello" but you're in Normal mode:

  • h → move cursor left
  • e → move to end of word
  • l → move cursor right
  • l → move cursor right
  • o → open a new line below + enter Insert mode!

If the cursor suddenly jumps around and a new line appears, you were typing in Normal mode. Don't panic — press Escu (undo).

Deep Dive

  1. Open a file with vim practice-modes.txt.
  2. Press i, type "First line", and press Esc.
  3. Press o, type "Second line", and press Esc.
  4. Press O above the first line and type "Title", then press Esc.
  5. Move to the end of the first line and press A to append " (added)", then press Esc.
  6. Save with :wq and check the result with cat practice-modes.txt.

Quiz

Why doesn't your text appear when you start typing right after opening Vim?

Which key lets you start typing immediately at the end of the current line?

You don't know what mode you're in. What should you do first?