Learn Practice Daily golf Reference
Foundations·Lesson 6 of 6·10 min·0/5 exercises

The noon rush

Everything from track one on one file against the clock: inspect it, repair the Formatter's damage, finish it with o O A I and ship. Then take it home: open, save and quit in a real terminal.

Scene

Day three, 11:42 a.m. The new lunch menu has to ship at noon, the riders are already lined up outside, and overnight the Formatter ran again. It got to lunch.ts: semicolons missing, first letters gone, stray letters everywhere, as if a cat walked across the keyboard.

Eighteen minutes, one file, everything from your first three days. No mouse.

From memory

Warm-up from earlier chapters

Two from earlier chapters, from memory, before the new idea. Two wrong tries show the answer.

Onto the next comma.
press the keys…2 keys
1 of 2
Onto the next comma.

Your kit, in one picture

Every motion from this track, one press each from the same cursor. Take ten seconds with it before you start: lowercase pins above the line, uppercase below. The clock beside each stage times you for your own records; the deadline is the story's.

if (!item) throw new Error("not on the menu: " + id);0^bew$f"t:BWEF(
One press each. Lowercase stops at punctuation and finds forwards; uppercase jumps whole WORDs and finds backwards.
Boss round

Stage 1 · Inspection

11:43. Before you touch anything, read the file: check the three prices, then visit each spot the build log complained about. Every stop says where it is. Any motion from the track; fewest keys wins.

Stuck? Show a hintf or t for a character you can see, w / e / W for words, j / k with a count for lines, $ and ^ for the ends
1 of 10The Al Pastor price: 9.5.
1export const lunch = [
1 { id: "al-pastor", name: "Al Pastzor", price: 9.5, spicy: true },
2 { id: "veggie", name: "Garden Veggie", price: 8.25, spicy: fqalse },
3 { id: "carnitas", name: "Carnitjas", price: 10, spicy: false },
4]
5
6const LUNCH_STARTS = 11
7xport const LUNCH_ENDS = 15;
8
9export function onLunchMenu(id: strzing) {
10 eturn lunch.some((item) => item.id === id)
11}
NORMALLoading the editor…1/100.0s1:1

This exercise needs a keyboard. Read on, and play it at your computer.

Boss round

Stage 2 · The Formatter

11:49. Now undo the night's damage, top to bottom: three stray letters, three lost semicolons, two lost first letters, and one more stray. Each one is marked. Get there, fix it, move on.

Stuck? Show a hintstray letter: ride to it, x · lost semicolon: A;<Esc> · lost first letter: I + the letter + <Esc>
1 of 9Delete the text marked red
1export const lunch = [
1 { id: "al-pastor", name: "Al Pastzor", price: 9.5, spicy: true },
2 { id: "veggie", name: "Garden Veggie", price: 8.25, spicy: fqalse },
3 { id: "carnitas", name: "Carnitjas", price: 10, spicy: false },
4]
5
6const LUNCH_STARTS = 11
7xport const LUNCH_ENDS = 15;
8
9export function onLunchMenu(id: strzing) {
10 eturn lunch.some((item) => item.id === id)
11}
NORMALLoading the editor…1/90.0s1:1

This exercise needs a keyboard. Read on, and play it at your computer.

Boss round

Stage 3 · Ship it

11:56. The file builds again. Four last changes before it ships: a comment on the very first line, the new birria line under the veggie one, LUNCH_STARTS exported like its neighbour, and a note at the end of LUNCH_ENDS. The marks show the text. Each one has a door that works from anywhere on its line.

Stuck? Show a hintO on the first line · o on the veggie line · I on LUNCH_STARTS · A on LUNCH_ENDS
1 of 4Add the green line // Lunch menu: ships at noon
+// Lunch menu: ships at noon
1export const lunch = [
1 { id: "al-pastor", name: "Al Pastor", price: 9.5, spicy: true },
2 { id: "veggie", name: "Garden Veggie", price: 8.25, spicy: false },
3 { id: "carnitas", name: "Carnitas", price: 10, spicy: false },
4];
5
6const LUNCH_STARTS = 11;
7export const LUNCH_ENDS = 15;
8
9export function onLunchMenu(id: string) {
10 return lunch.some((item) => item.id === id);
11}
NORMALLoading the editor…1/40.0s1:1

This exercise needs a keyboard. Read on, and play it at your computer.

ShippedFinish the exercise above to see it.
From memory

Six from the track, from memory

Six situations from your first three days. Press the keys.

Down four lines, in two keys.
scroll here, then press the keys2 keys
1 of 6
Down four lines, in two keys.

Take it home

Everything so far happened in this page. A real Vim works the same way, plus the two things this page can't do: open a file and save it. Open one from a terminal and you start in Normal mode, remote in hand. Saving and quitting are commands you type on the status line: :, the command, then Enter.

KeysWhat happens
:w↵save (write) the file
:q↵quit; if there are unsaved changes, Vim refuses and says so
:wq↵save, then quit
:q!↵quit and throw away every change since the last save

Extra practice optional

The chapter is done. These rounds keep going as long as you like: stop whenever it stops being useful.

Endless

From the archive: the Formatter

The Formatter is switched off, but its logs make good practice: endless mixed repairs replayed from the incident, across the codebase, in bigger batches as you go.

Level 1Delete the text marked red
1export const cojnfig = {
1 apiUrl: "https://api.byteburrito.dev",
2 cujrrency: "USD",
3 taxRate: 0.0875,
4 openHour: 11,
5 loseHour: 23,
6 slogan: "Code by day, burritos by night",
7};
NORMALLoading the editor…lv 1 · 0 done0.0s1:1

This exercise needs a keyboard. Read on, and play it at your computer.