Compose an edit
The technique
c is the operator and w the motion. With d in place of c, dw would delete the word and the space after it.
Keys in this lesson
- dw
- Delete to the next word.
- de
- Delete to the end of the word.
- cw
- Change to the end of the word.
- dd
- Delete the line.
- cc
- Change the line.
- yy
- Copy the line.
- p
- Put after the cursor, or below the line.
Before this lesson: Choose where typing begins.
More about this lesson
Combine an operator with a familiar motion; distinguish delete, change and copy.
An operator asks what to do; a motion says how far. d deletes and stays in Normal; c changes and enters Insert; y copies without removing. de deletes through a word end. cw at a word start changes that word. Doubled dd, cc and yy act on a whole line. p puts copied text after the cursor, or below the current line for a linewise copy.
Example
From p in “pack bags”, cw then “carry” then Esc gives “carry bags”. dw would remove the word and following gap. yy then p duplicates a complete line; the original stays.
Use Reset to try again.