Modal Editing

The defining feature of Vim is that it is modal. This means the same key can do different things depending on which “mode” you are in.

  • In Insert Mode, typing d inserts the letter “d”.
  • In Normal Mode, typing d waits for a motion to delete something.

Understanding these modes is the first step to Vim mastery.

1. The Big Four Modes

1. Normal Mode (The Default)

This is where you spend most of your time. It is for navigation and manipulation.

  • Purpose: Moving around, deleting, copying, pasting.
  • Entry: Press <Esc> from any other mode.
  • Cursor: Usually a block.

[!IMPORTANT] Always return to Normal Mode. Think of Insert Mode as holding your breath. You dive in to type, then immediately come back up for air (Normal Mode) to look around.

2. Insert Mode

This is for typing text. It behaves like a standard text editor.

  • Purpose: Adding new content.
  • Entry: i (insert before cursor), a (append after cursor), o (open new line below).
  • Exit: Press <Esc>.
  • Cursor: Usually a thin vertical bar.

3. Visual Mode

This is for selecting text.

  • Purpose: Highlighting text to apply an operator (delete, yank, indent).
  • Entry: v (character-wise), V (line-wise), Ctrl+v (block-wise).
  • Exit: Press <Esc>.

4. Command-Line Mode

This is for Ex commands.

  • Purpose: Saving files, quitting, searching, and complex operations.
  • Entry: : (colon).
  • Exit: Press <Esc> or <Enter> to execute.

2. Interactive: Mode Switcher

Practice switching between modes. Observe how the status bar and cursor change.

NORMAL
1 The quick brown fox jumps over the lazy dog.
Press i to insert, v to select, Esc to return to Normal.

3. Mode Transitions

Visualize the modes as a state machine. The arrows show which keys take you from one mode to another.

NORMAL INSERT VISUAL COMMAND i, a, o Esc v, V Esc : Esc/Enter

4. Summary

  • Normal Mode is your home base.
  • Insert Mode is strictly for typing.
  • Visual Mode is for selection.
  • Command Mode is for editor commands.