Build one repeatable change
The technique
The dot repeats the whole change, including the jump to the end of the line that A makes.
Keys in this lesson
- .
- Repeat the last change.
- A
- Insert at the end of the line.
Before this lesson: Insertion doors and character search.
More about this lesson
Make a change once, in a way the dot can repeat.
The dot repeats your last complete change, from the command that starts it to Esc. A includes the jump to the end of the line, so it works on lines of any length. I does the same for the start of the line. i types where the cursor is, so move to the right place before you repeat it. O opens a line above the one you're on. The dot repeats the change, not the moves you made before it.
Example
Press A, type a status at the end of the line and press Esc. Then press j and the dot. It works even if the next line is a different length, because A does the jump to the end for you.
Use Start over to try again.
Guides on this topic
Exercise 1 of 4
0keys
par 7Turn off the two lines that log every event, so they stay in the file for debugging.
Make it look like this
import { getConsent } from "../privacy/consent"; const ENDPOINT = "https://stats.northwind.shop/collect"; // Sends one analytics event, if the visitor said yes to statistics. export function track(name, props = {}) { // console.log("track", name); // console.log("props", props); if (!getConsent().statistics) return; const body = JSON.stringify({ name, props, page: location.pathname }); navigator.sendBeacon(ENDPOINT, body); }