Edit a whole word
The technique
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.