Learn Practice Daily golf Reference
Visual mode·Lesson 2 of 7·7 min·0/8 exercisesPro

V for lines

The highlighter's wide edge: V marks whole lines from anywhere on them, j and } grow it, and d y > J act on every line; p puts them back whole.

Scene

Friday, 10:05 a.m. The accountant again: "The test orders are still in, the ones that say TEST. Delete them. And the refunds go at the bottom, where I can find them."

Rows, not words. Whole lines, from wherever your cursor happens to be on them.

From memory

Warm-up from earlier chapters

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

Highlight up to the next underscore and delete it.
press the keys…4 keys
1 of 2
Highlight up to the next underscore and delete it.

The wide edge

Turn the highlighter on its wide edge: V marks the whole line, whatever column you're in. Vertical motions grow it by whole lines (j, 3j, }, G), and then the verb acts on every line marked: d deletes them, y copies them, > and < indent them, J joins them into one.

Before
id,item,quantity,price,status
2201,TEST,1,0.00,test
2202,TEST,1,0.00,test
2203,TEST,1,0.00,test
2204,TEST,1,0.00,test
2205,carnitas,1,10.00,delivered
2206,al-pastor,4,9.50,delivered
2207,birria,3,11.00,delivered
2208,veggie,2,8.25,late
V3jd
id,item,quantity,price,status
2205,carnitas,1,10.00,delivered
2206,al-pastor,4,9.50,delivered
2207,birria,3,11.00,delivered
2208,veggie,2,8.25,late
V marks the whole line from the middle of it, 3j three more, and d takes all four.
Try it

Test orders out

The four TEST rows, from 2201 to 2204. One highlight, one verb.

Fix the marked spots · 4 left
1id,item,quantity,price,status
12201,TEST,1,0.00,test
22202,TEST,1,0.00,test
32203,TEST,1,0.00,test
42204,TEST,1,0.00,test
52205,carnitas,1,10.00,delivered
62206,al-pastor,4,9.50,delivered
72207,birria,3,11.00,delivered
82208,veggie,2,8.25,late
NORMALLoading the editor…0.0s1:1

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

Check yourself

Narrow tip or wide edge?

1id,item,qty
21001,al-pastor,2
11002,veggie,1
21003,birria,4
NORMAL
Keys pressed: Vjd

Same rows as this morning, but this time you press V, j, d. What is left?

Pick an answer (or press its number), then watch the engine prove it.

Lift out, put down

What you cut with V goes in the jar as whole lines, and p puts whole lines back below the cursor's line (P above), wherever on the line the cursor is. So moving rows is three steps: highlight and d, go to the line they belong under, p. To the bottom of the file: G then p.

2id,item,quantity,price,status
12205,birria,2,11.00,delivered
32206,veggie,1,8.25,refunded
12207,carnitas,3,10.00,refunded
22208,pollo,2,9.00,late
32209,al-pastor,4,9.50,delivered
NORMALLoading the editor…3:1
Try it

Refunds last

The two refunded rows go to the bottom of the file: Vj d, G, p.

Pro
The rest of this lesson is in Pro

The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.

See Pro

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

Try it

Indent the body

The report script lost its indentation. Highlight the four lines of the body and >.

Pro
The rest of this lesson is in Pro

The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.

See Pro

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

From memory

Wide edge, from memory

Press the keys.

Highlight this line and the next, and delete them.
scroll here, then press the keys3 keys
1 of 4
Highlight this line and the next, and delete them.
Challenge

Rows and blocks

Clusters of junk lines and unindented lines across the codebase. The wide edge, or a counted dd and >> if you prefer.

Pro
The rest of this lesson is in Pro

The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.

See Pro

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

Boss round

The export, rows and all

10:40. The real export, where the test rows are 2202 to 2204: the three TEST rows go (2201 and 2205 are real orders, and stay), and the two refunds move to the bottom of the file.

Stuck? Show a hint
Pro
The rest of this lesson is in Pro

The first exercise of every lesson is free. Pro unlocks the rest, every track, for good.

See Pro

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

The accountant’s checkFinish the exercise above to see it.