Learn Vim / How to Change a Word in Vim

How to Change a Word in Vim

The answerWith the cursor anywhere on the word, press ciw — the word vanishes and you're in insert mode. Type the new word, press Esc.

Try it on a real buffer

The review wasn't that bad. You're on the word — press ciw (change inner word), type wonderful, then Esc.

The code review was terrible.

Canonical solution: ciw wonderful Esc · target: 13 keystrokes — the fewest that solve it (every keypress counts).

Why it works

c is the change operator: delete + enter insert mode. ciw works from anywhere inside the word — no need to be at its start. Compare with cw, which changes from the cursor onward.

Variations

KeysWhat it does
ciwchange inner word (from anywhere in it)
cwchange from the cursor to the end of the word
cawchange the word plus its space
Cchange to the end of the line
▶ live vim buffertarget 13 keystrokes
The review wasn't that bad. You're on the word — press ciw (change inner word), type wonderful, then Esc.

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “Attitude adjustment” mission takes about a minute.

Sign in free to practice →

Keep going