One key to move, one to repeat
The dot formula: make one change you can stamp, then slide and stamp: ; . along a line, j . down a run. s swaps one character.
11:25 a.m. Ten happy-hour lines left, and they're scattered: two lines apart here, three commas along a line there. The stamp still works. Getting to each spot is what's slow.
The lunch rush starts at noon, and the packing table downstairs is already busy. Watch how they do it.
Warm-up from earlier chapters
Two from earlier chapters, from memory, before the new idea. Two wrong tries show the answer.
Slide, stamp
On the packing table the bags sit in a row: slide your hand to the next bag, stamp it, slide, stamp. That's the dot formula. Make one change you can stamp, then every repeat costs two keys: one to move to the next spot, and . to stamp it.
const total = base+tax+tip;const total = base + tax+tip;const total = base + tax + tip;+, then ; slides to the next + and . stamps it.s swaps one character
On its last night, the Formatter squeezed the spaces out of the maths. s deletes the character under the cursor and starts Insert mode, so on a squeezed + you press s, type + , and Esc: one change, ready to stamp. f+ gets you to the first one, and ; slides to each one after.
Give the operators room
Three lines, two squeezed operators each. f+ (or f*) to the first, s to fix it, then ; . for the second.
This exercise needs a keyboard. Read on, and play it at your computer.
Stamp without sliding
You press f,, then a, a space and Esc. Then . twice, with no ;. What does the line look like?
Let the list breathe
Every comma lost the space after it. Fix the first with f, and a, then slide and stamp along the line.
This exercise needs a keyboard. Read on, and play it at your computer.
Pick the slide
The stamp stays the same; the slide depends on where the next bag is. Directly below? j .. The next copy of a character on the same line? ; .. Look for the move that lands exactly on the next spot: one key to slide, one to stamp. A longer slide still gets the job done; it just costs more keys.
const total = base+tax+tip+fee+rush;+, and each ; to the next: one key per bag.One slide too far
You stamped the first comma, then pressed ; twice and slid right past the second. , slides back the other way, as it did in track 1. Stamp the one you missed, then carry on along the line.
This exercise needs a keyboard. Read on, and play it at your computer.
Slide and stamp, from memory
Read the situation, press the keys.
Happy-hour spacing
Squeezed operators and lost semicolons across the pricing code. Make the first fix, then pick the slide that reaches the next spot.
Stuck? Show a hint
operators: f+s + <Esc> then ;. · semicolons: A;<Esc> then j.This exercise needs a keyboard. Read on, and play it at your computer.
The tax line
The happy-hour function itself. Semicolons down the top three lines, room around every + in the total, and a space after every comma in the log call. Three changes, each stamped along its own slide.
Stuck? Show a hint
A;<Esc> then j. j. · f+s + <Esc> then ;. · f,a <Esc> then ;. ;. ;.This exercise needs a keyboard. Read on, and play it at your computer.
Extra practice optional
The chapter is done. These rounds keep going as long as you like: stop whenever it stops being useful.
The packing line
Endless spacing and semicolon repairs, bigger batches as you go. Find the rhythm and keep it.
This exercise needs a keyboard. Read on, and play it at your computer.