Compose an edit

0 of 3

The technique

Your textVim mode: Normal
Change pack to carry. Before: pack bags. After: carry bags.

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.

Guides on this topic

Exercise 1 of 3

0keys

par 2

Remove “Draft ”, including its following space.

Your textVim mode: Normal

Desired result

const message = "short report";

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.