Edit a whole word

0 of 6

The technique

Your textVim mode: Normal
Change draft to final. The cursor is in the middle of the word. Before: Send the draft report.. After: Send the final report..

ciw takes the whole word, wherever the cursor is in it. cw from the same spot would leave dr behind.

Keys in this lesson

ciw
Change the word under the cursor.
diw
Delete the word, keep the spaces.
daw
Delete the word and one space.
Before you begin

Use h, j, k, l to move in Normal mode. Esc ends insertion; u undoes an edit. 0 reaches the line start; 2G reaches line 2. A count repeats a movement, so 3l moves three characters right.

More about this lesson

Change or delete a whole word, with or without the adjacent space.

c changes a region and enters Insert mode. d deletes it and stays in Normal mode. iw means the whole word, even from its middle; letters, digits and underscores belong to one word here. aw includes neighbouring whitespace.

Change or delete a word

Pack a small bag. → Pack a light bag.

From inside “small”, ciw, then light, then Esc changes the whole word. cw from its middle would leave its beginning behind.

Pack a very light bag. → Pack a light bag.

From “very”, daw removes the word and its following space. At a line end with no following whitespace it takes the preceding space. Inspect the target when punctuation is adjacent.

Guides on this topic

Exercise 1 of 6

0keys

par 14

Replace draftCount with finalCount. Keep the rest of the line.

Your textVim mode: Normal

Desired result

const reminder = "Keep this line unchanged.";
const finalCount = 4;

Yours

Par

Keyboard shortcuts
Ctrl+Enter
Check the result
Ctrl+Alt+U
Undo the last change
Ctrl+Alt+H
Show the next hint
Ctrl+Alt+R
Reset the exercise
Ctrl+Alt+P
Previous exercise
Ctrl+Alt+N
Next exercise
Enter
After a solve: the next step

Ctrl+Alt shortcuts leave Vim's own keys alone. On a Mac, Control and Option.