Protect a useful copy
The technique
After dd, a plain p would put obsolete. Register 0 still holds the copy.
Keys in this lesson
- "0p
- Put your last copy, even after a delete.
- "_dd
- Delete a line without replacing your copy.
- "ayy
- Copy the line into register a.
- "ap
- Put from register a.
Before this lesson: Copy and move text.
More about this lesson
Keep something you copied safe while you delete other text, or save it under a name.
Copying also fills register 0. A later delete or change replaces what a plain p puts, but register 0 keeps your last copy, so "0p still puts it. "_dd deletes a line without touching your copy. "ayy copies a line into register a and "ap puts it. A lowercase a replaces what's in that register. An uppercase A adds to it instead, but you won't need that here.
Example
Copy a heading with yy, delete an obsolete line with dd, then use "0p to put the heading instead of the deleted line.
Use Start over to try again.
Guides on this topic
Exercise 1 of 3
0keys
par 15Serve images from media.northwind.shop first, and keep the img host as the last fallback.
Make it look like this
import { pickHost } from "./pickHost"; // Image hosts, tried in order until one answers. export const IMAGE_HOSTS = [ "https://media.northwind.shop", "https://images.cdn-eu.example", "https://images.cdn-us.example", "https://img.northwind.shop", ]; export const imageUrl = (path) => pickHost(IMAGE_HOSTS) + path;