Compound commands
A I C S o O are combos: a motion and a change in one key, so . repeats them from anywhere on the line.
2:15 p.m. The specials board lives in specials.ts, and the kitchen has changed its mind about half of it. Line endings to rewrite, whole lines to replace.
You've used A since your first night. What you haven't noticed is why it works so well with this morning's stamp, and that it has siblings for rewriting a line's ending or the whole line.
Warm-up from earlier chapters
Two from earlier chapters, from memory, before the new idea. Two wrong tries show the answer.
Two for one
The Byte Burrito menu has combos: a burrito and a drink, one order, one price. Vim has them too. A is $ and a ordered as one key; I is ^ and i; o is A plus a new line. The doors from that 3 a.m. call were combos all along.
Order them separately
You add a ; to line 1 with $ a ; Esc, then press j and .. What does line 2 become?
Combos from anywhere
Semicolons missing again. A once, then j . from wherever the cursor lands: the combo carries the jump to the end.
This exercise needs a keyboard. Read on, and play it at your computer.
C: the rest of the line
C deletes from the cursor to the end of the line and starts Insert mode: a delete and a door in one order. Perfect for a line whose start is right and whose end is wrong.
const theme = "light"; // default const theme = "dark";New endings
The end of each line is wrong. Get to where the wrong part starts, then C and type the right ending.
This exercise needs a keyboard. Read on, and play it at your computer.
S: the whole line
S clears the whole line and starts Insert mode, from anywhere on the line, keeping the indentation (see the note below for Vim). When nothing on a line is worth keeping, it's the cheapest combo on the menu.
function first(items) { return null;}function first(items) { return items[0];}Start the line over
Each marked line is junk where code should be. S and type the line back.
This exercise needs a keyboard. Read on, and play it at your computer.
Order the combo
From memory: one key, then type if you need to.
Rewrite the specials
Wrong endings, junk lines and missing semicolons across the codebase. Pick the combo that needs the least walking each time.
This exercise needs a keyboard. Read on, and play it at your computer.
The specials board
The board goes up at 4. The header needs (updated daily) on its end. Tuesday's special is still a TODO: it should read "Burrito of the day",. A junk line sits where Thursday's thursday: "Free guac", should be, and friday: "Happy hour from 5", is missing altogether, right after it. One combo each; pick the one that needs the least walking.
Stuck? Show a hint
header: A · Tuesday, from the first quote: C · the junk line: S · Friday, from Thursday: oThis 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.
Combo kitchen
Endless endings, junk lines and semicolons. Pick the combo, fix it, move on.
This exercise needs a keyboard. Read on, and play it at your computer.