Vim’s insert, change, and delete commands aren’t just about typing text; they’re about manipulating the state of the buffer, and the real magic is how quickly you can transition between these states.

Let’s see it in action. Imagine you’re editing a file and you want to replace the word "foobar" with "bazqux".

This is some text with foobar in it.

You’d move your cursor to the 'f' of "foobar", press ciw (change inner word), and then type bazqux.

This is some text with bazqux in it.

Boom. Done. But ciw is just the tip of the iceberg.

The core problem Vim’s editing commands solve is minimizing keystrokes for common text transformations. Instead of navigating to the start of a word, deleting it, and then navigating to the end and inserting, Vim combines these actions. It’s built on the idea of "operator-motion" pairs. An operator is an action like delete (d), change (c), or yank (y). A motion is how you tell Vim where to perform that action.

Here are the fundamental operators:

  • d (delete): Removes text.
  • c (change): Deletes text and immediately enters insert mode. It’s like d followed by i (insert).
  • y (yank): Copies text to Vim’s register (clipboard).

And here are some common motions:

  • w: Move forward to the beginning of the next word.
  • b: Move backward to the beginning of the current or previous word.
  • e: Move forward to the end of the current or next word.
  • $: Move to the end of the line.
  • ^: Move to the first non-blank character of the line.
  • f<char>: Move forward to the next occurrence of <char> on the current line.
  • t<char>: Move forward to the character before the next occurrence of <char> on the current line.

Combining these gives you powerful commands:

  • dw: Delete from the cursor to the start of the next word.
  • db: Delete from the cursor to the start of the current word.
  • d$: Delete from the cursor to the end of the line.
  • d^: Delete from the cursor to the first non-blank character of the line.
  • dfx: Delete from the cursor up to and including the next 'x'.
  • dtx: Delete from the cursor up to (but not including) the next 'x'.

And for c (change), it’s the same motions, but you end up in insert mode:

  • cw: Change from the cursor to the start of the next word.
  • cb: Change from the cursor to the start of the current word.
  • c$: Change from the cursor to the end of the line.
  • c^: Change from the cursor to the first non-blank character of the line.
  • cfx: Change from the cursor up to and including the next 'x'.
  • ctx: Change from the cursor up to (but not including) the next 'x'.

You can also use counts. d3w will delete three words. c2b will change from the cursor to the beginning of the second preceding word.

There are also "inner" and "outer" variations for text objects.

  • iw: inner word. ciw changes the word the cursor is on.
  • aw: a word (includes leading/trailing whitespace). daw deletes the word the cursor is on, plus a space.
  • is: inner sentence.
  • as: a sentence.
  • ip: inner paragraph.
  • ap: a paragraph.

So ciw is c + iw. daw is d + aw.

What most people don’t realize is that the c operator is specifically designed to replace text. When you use ciw, Vim deletes the entire word and then immediately puts you in insert mode, ready to type your replacement. It’s not just deleting and then manually hitting i. This is why ciw is so much faster than viw (visual select inner word) followed by d and then i.

The next step is understanding how these operators and motions interact with Vim’s registers for more complex manipulation, like deleting lines and inserting them elsewhere.

Want structured learning?

Take the full Vim course →