Vim doesn’t actually have modes in the way you’re probably thinking.

Let’s see Vim in action. Imagine you’re editing a configuration file, ~/.bashrc. You want to change a line that sets your PATH.

# Current line:
export PATH="/usr/local/bin:$PATH"

# You press 'i' to enter Insert mode.
# Now you can type:
export PATH="/usr/local/opt/python/bin:$PATH"

# Then you press 'Esc' to exit Insert mode and return to Normal mode.
# You want to delete the next 5 characters. You press 'd5'.
# The line is now:
export PATH="/usr/local/opt/python/bin:$PATH"

# You want to save and quit. You press ':wq'.

This isn’t just about typing commands; it’s about a state machine. Vim’s "modes" are better understood as distinct states that dictate how your keystrokes are interpreted. Normal mode is the default, where keys perform actions like moving, deleting, or copying. Insert mode is for typing text, just like any other editor. Visual mode lets you select text for manipulation. Command-line mode (entered by pressing :) is for executing powerful commands. The magic is in the seamless transitions between these states, allowing for incredible efficiency once you grasp them.

The core problem Vim solves is efficient text manipulation without constantly reaching for the mouse. It treats the text you’re editing as data to be transformed, and its modal nature is the engine for that transformation. Think of Normal mode as your "command console" and Insert mode as your "text entry pad." You spend most of your time not typing, but navigating and modifying, which is what Normal mode excels at.

Internally, Vim maintains a buffer of text and a cursor position. Keystrokes are processed based on the current mode. In Normal mode, a key like j doesn’t insert the letter 'j'; it tells Vim to move the cursor down one line. The d command, followed by a motion (like w for word, $ for end of line), tells Vim to delete from the current cursor position to the position reached by that motion. This is why dw deletes a word and d$ deletes to the end of the line.

The levers you control are primarily your keystrokes and how you combine them. Learning Vim is about memorizing these combinations. Start with the basics:

  • Normal Mode:
    • h, j, k, l: Left, Down, Up, Right (the classic Vim motion keys)
    • w, b: Move forward/backward by word
    • 0, $: Move to the beginning/end of the line
    • gg, G: Move to the first/last line of the file
    • i: Enter Insert mode before the cursor
    • a: Enter Insert mode after the cursor
    • o: Enter Insert mode on a new line below the cursor
    • O: Enter Insert mode on a new line above the cursor
    • x: Delete character under the cursor
    • dd: Delete the current line
    • yy: Yank (copy) the current line
    • p: Paste yanked/deleted text
    • u: Undo
    • Ctrl+r: Redo
  • Insert Mode: Type text normally.
  • Command-line Mode (starts with :):
    • :w: Write (save) the file
    • :q: Quit
    • :wq: Write and quit
    • :q!: Quit without saving
    • :/pattern: Search forward for pattern
    • :?pattern: Search backward for pattern`
    • :s/old/new/g: Substitute old with new globally on the current line.

The true power of Vim’s modal editing isn’t just in its commands, but in how you can prefix those commands with counts and chain them together with motions. For instance, 3dd deletes three lines. y2w yanks two words. c3w (change three words) is equivalent to d3w followed by entering Insert mode. This additive nature, where a verb (like d for delete, y for yank, c for change) is followed by a motion or a count-motion, forms the bedrock of Vim’s speed.

Once you’re comfortable with basic editing, the next frontier is understanding Vim’s registers and macros.

Want structured learning?

Take the full Vim course →