Mission 15 / 52• Basic Operators

Change Words

In many editors, changing a word takes: select word, delete, and type. In Vim, `cw` does all three in two keystrokes.

The `c` (change) operator deletes the target and automatically switches to insert mode.

Change word commands

  • cwchange to the end of the word and enter insert mode
  • cechange to the end of the current word
  • c$change from cursor to the end of the line
1
const firstName = "Alice";
2
const role = "guest";

Move to `guest`, press `cw`, type `admin`, then press `esc`. You replaced the word in a single breath.

Now it's your turn!

  1. Navigate to each green target across the code snippet.
  2. Use the motions and techniques learned in this lesson to land accurately on each target.
  3. See how fast you can complete 10 targets.
0/10
1
const firstName = "Alice";
2
const role = "guest";
NORMAL
00:00
NextCtrl+jDelete Lines