Recover and cancel
The technique
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 1You deleted the attempts line by mistake. Get it back.
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, }, });