Compose an edit

0 of 5

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

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 3

Delete the console.log that prints the token.

Your textVim mode: Normal

Make it look like this

import { request } from "./base.js";

export async function signIn(email, password) {
  const { token } = await request("/sessions", { method: "POST", body: { email, password } });
  localStorage.setItem("northwind.token", token);
  return token;
}

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
Start the exercise over
Ctrl+Alt+P
Previous exercise
Ctrl+Alt+N
Next exercise
Ctrl+Alt+K⌃⌥K
Show the keyboard shortcuts
Ctrl+Alt+F⌃⌥F
Turn focus mode on or off
Ctrl+Alt+S⌃⌥S
Open the editor settings
Enter
Go on to the next step after you finish

The Ctrl+Alt shortcuts don't clash with Vim's own keys. On a Mac, use Control and Option.