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
Put an operator together with a motion to delete, change or copy text.
The operator says what to do and the motion says how far. d deletes and keeps you in Normal mode, c deletes and puts you in Insert mode, and y copies without deleting. de deletes to the end of a word. cw at the start of a word changes that word. Doubled, as dd, cc and yy, they work on the whole line. p puts copied text after the cursor, or below the current line if you copied a whole line.
Example
From p in “pack bags”, cw then “carry” then Esc gives “carry bags”. dw would delete the word and the space after it. yy then p puts a copy of the whole line below and keeps the original.
Use Start over to try again.
Guides on this topic
Exercise 1 of 5
0keys
par 3Delete the console.log that prints the token.