First edits and modes

0 of 3

The technique

Your textVim mode: Normal
Put A in front of plan. The cursor is on the p. Before: const message = "plan";. After: const message = "A plan";.

i starts typing before the cursor. Esc ends the insertion and takes you back to Normal mode, where keys are commands again.

Keys in this lesson

i
Insert before the cursor.
Esc
Back to Normal mode. It also cancels a command you've started.
hjkl
Left, down, up, right.
x
Delete one character.
r
Replace one character with the next one you type.

Before this lesson: Start here: Your first Vim edit.

More about this lesson

Switch into Insert mode and back, then move to a letter and fix it.

In Normal mode your keys are commands, and in Insert mode they type text. i starts typing before the cursor and Esc takes you back to Normal mode. h, j, k and l move left, down, up and right. x deletes the character under the cursor. r followed by a character replaces just that one character, and you stay in Normal mode.

Example

From the p in “plan”, i then “A ” then Esc makes “A plan”. From the a in “plam”, press l to move onto the m, then rn to fix the last letter. Check the mode label before you type.

Use Start over to try again.

Guides on this topic

Exercise 1 of 3

0keys

par 9

request returns a promise, so order.status is always undefined. Add await before request.

Your textVim mode: Normal

Make it look like this

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

// Cancels an order that hasn't shipped yet.
export async function cancelOrder(id) {
  const order = await request(`/orders/${id}/cancel`, { method: "POST" });
  return order.status;
}

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.