Mission 38 / 52• Text Objects - Words

Delete Inside Word

`diw` ('delete inside word') deletes the word under the cursor, leaving the surrounding spaces untouched.

Crucially, your cursor can be anywhere on the word: start, middle, or end.

Delete inside word

  • diwdelete the current word (preserves surrounding spaces)
1
const firstName = "Bob";
2
const totalAmount = 100;

Place cursor in the middle of `firstName` (e.g. on `s`) and press `diw`. Only the word identifier is deleted.

Now it's your turn!

0 / 4 tasks complete0.0s / 16s par0 / 17 par

Practice this lesson's commands. Each task checks your technique and the result, not just your cursor position. Take your time.

Task 1: Delete obsolete with diw. Preserve adjacent spaces.

Expected result
const  = 10;
Show hint

Use diw from inside the word.

1
const obsolete = 10;
jkscroll•ggGtop/bottom•Tabnext example•Enterstart•qstop•Ctrl+kCtrl+jprev/next