Recover and cancel

0 of 3

The technique

Your textVim mode: Normal
Type the wrong word, undo it, then type the right one. Before: note. After: careful note.

Everything typed between i and Esc is one change, so one u removes all of it.

Keys in this lesson

u
Undo the last change.
Ctrl-r
Redo it.
Esc
Back to Normal mode. It also cancels a command you've started.

Before this lesson: First edits and modes.

More about this lesson

Undo a change, redo it, and cancel a command you started without changing any text.

u undoes one change in Normal mode and Ctrl-r redoes it. Ctrl-r is not the same as the site's Start over shortcut. Everything you type between i and Esc is one change, however long it is, and so is a command like dd. u works wherever the cursor is, and takes it back to where the change was. Esc cancels an operator you started, such as d, and it also leaves Insert mode. Start over puts this exercise back the way it started, mistake and all. It doesn't touch your saved progress.

Example

If you type “wrong ” before “note”, Esc then u removes all of it, and Ctrl-r brings it back. If you press d and change your mind before the motion, press Esc. Then make the edit you meant.

Use Start over to try again.

Guides on this topic

Exercise 1 of 3

0keys

par 1

You deleted the attempts line by mistake. Get it back.

Your textVim mode: Normal

Make it look like this

import { Queue } from "bullmq";
import { redis } from "../lib/redis.js";

// Sends order emails in the background.
export const emailQueue = new Queue("emails", {
  connection: redis,
  defaultJobOptions: {
    attempts: 5,
    backoff: { type: "exponential", delay: 2000 },
    removeOnComplete: true,
  },
});

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.