Counts everywhere
Say the number: 3dd, d3w (or 3dw), 3p, 5.. Two numbers multiply.
Tuesday, 4:40 p.m. The nightly report lists what the old code left behind: four debugger lines in a clump here, three console.log calls there, a call with three dead arguments.
You could say dd four times. But a language has numbers, so say it once: delete four lines.
Warm-up from earlier chapters
Two from earlier chapters, from memory, before the new idea. Two wrong tries show the answer.
Say the number
Put a number in the sentence and Vim does it that many times. 3dd deletes three lines. d3w reads delete three words. And 3dw, three times, delete a word, deletes exactly the same three words: put the number wherever it reads best to you.
send(rows, true, false, null, "legacy");send(rows, true, false, null, "legacy");send(rows, true, false, null, "legacy");Clumps
Each clump of junk lines goes in one sentence: get onto the first line, count, dd.
This exercise needs a keyboard. Read on, and play it at your computer.
Numbers multiply
Two numbers in one sentence multiply. 2d2w reads twice, delete two words: four words. You'll rarely type it on purpose, but it explains a surprise when a count you meant for the noun lands on the verb too.
Count the words
You press 2d2w at the start of the line. What is left?
Dead arguments
Three arguments nobody reads. From the t of true, one sentence with a count: d3W treats each name, as one WORD. Or skip the counting and name where to stop: dt" deletes till the quote. Either sentence gets the same result.
The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.
See ProThis exercise needs a keyboard. Read on, and play it at your computer.
Pour and stamp, with a number
Numbers work on the jar and the stamp too. 3p pours the jar three times. And . remembers the count of the change it repeats: after 2dd, each . deletes two more lines.
// -------------------export function nightlyReport() {}// -------------------// -------------------// -------------------// -------------------export function nightlyReport() {}A new number on the stamp
Put a number in front of . and it replaces the old count; it doesn't multiply it. After 2dd, 3. means delete three lines, not delete two lines, three times.
Two, then three
Seven lines. You press 2dd, then 3.. How many lines are left?
Say it with a number
From memory.
Bulk trim
Clumps of junk lines and leftovers across the codebase. Say each one once, with a number when it helps.
The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.
See ProThis exercise needs a keyboard. Read on, and play it at your computer.
The nightly report
nightlyReport itself. Three console.logs and four debugger lines go, each clump in one sentence, then the three dead arguments in send.
Stuck? Show a hint
The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.
See ProThis 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.
Bulk trim, all night
Endless clumps and leftovers. Count, then say it once.
The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.
See ProThis exercise needs a keyboard. Read on, and play it at your computer.