Search as a motion
A search is a noun: d/ digs from the cursor up to the next match and keeps the match; c/ and y? work the same way.
Monday, 11:35 a.m. Found it: in delivery.ts, someone pasted a // TEMP: rider override block on Friday, and it swaps the latitude and the longitude of every order it touches, "for testing". It has to go, from the comment down to the end of the block, and the end is below the screen.
You can't see where it ends. The detector can.
Warm-up from earlier chapters
Two from earlier chapters, from memory, before the new idea. Two wrong tries show the answer.
Dig to the beep
A search is a noun like any motion. d/ reads delete up to the next match of what I type: dig from where you stand to the next beep. The match itself stays in the ground: the search stops just before it, so d/nearest↵ deletes everything up to nearest and keeps nearest.
assign(order, legacy, oldRider, nearest);assign(order, legacy, oldRider, nearest);nearest; dt) to the bracket. The search keeps what it found.Whole blocks
Because the match stays, you can cut a whole block of lines and keep the indentation: start on the block's first line, and search for the start of the line after the block. Everything in between goes, and the next line moves up into its place.
Dig out the override
The cursor goes to the // of the TEMP comment, then d/ up to the start of const stop (const s is enough). Then the three leftover arguments at the end of directions(…) go with d/)↵.
This exercise needs a keyboard. Read on, and play it at your computer.
What stays in the ground?
The cursor is on legacy. You press d/, type nearest, and ↵. What is left?
Change and copy
Any verb takes the noun. c/ digs up to the beep and starts Insert mode, for replacing a stretch of text you can't see the end of. y? copies back up to an earlier match, ready to pour out with p.
When nothing beeps
One more TEMP block, in quote. Your notes say it ends before const sum. From the //, type d/ and const sum and watch the highlight: at the s it goes dark, because nothing matches. Don't dig blind: Esc cancels, and nothing is deleted. (Pressing ↵ would delete nothing either; Vim just says Pattern not found.) Then dig to the line that is really there.
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.
Dig, from memory
Press the keys.
order.order.Three pasted blocks
dispatch has three // TEMP blocks from Friday. Each ends right before a line that stays: const, if and return. From each //, dig up to the line that stays.
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.
Leftovers, anywhere
Ten leftovers and wrong values across the codebase. Any verb, any noun, searches included.
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.