Learn Practice Daily golf Reference
Visual mode·Lesson 3 of 7·5 min·0/6 exercisesPro

o and gv

A highlight has two ends: o jumps to the other one so it can move, gv brings the last highlight back, and vip marks a whole paragraph in one stroke.

Scene

Friday, 11:00 a.m. More test rows turned up in the middle of the export. You start a highlight on the row in front of you, drag it down, and only then see that the test rows begin two rows higher. Starting over feels like a waste.

And a minute later a stray Esc wipes a highlight you'd just got right.

From memory

Warm-up from earlier chapters

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

Highlight this line and the next, and delete them.
press the keys…3 keys
1 of 2
Highlight this line and the next, and delete them.

The other end

A highlight has two ends, and you're holding one of them. o moves your hand to the other end: the cursor jumps there, and now your motions move that end instead. So a highlight started in the wrong place doesn't need starting again: o, fix the start, carry on.

4id,item,quantity,price,status
32201,al-pastor,1,9.50,delivered
22202,TEST,1,0.00,test
12203,TEST,1,0.00,test
52204,TEST,1,0.00,test
12205,TEST,1,0.00,test
22206,TEST,1,0.00,test
32207,birria,2,11.00,delivered
NORMALLoading the editor…5:1
Try it

From the middle out

The cursor is on the 2204 row, in the middle of the five TEST rows. Highlight down to the last one, o, up to the first, and d.

Fix the marked spots · 5 left
4id,item,quantity,price,status
32201,al-pastor,1,9.50,delivered
22202,TEST,1,0.00,test
12203,TEST,1,0.00,test
52204,TEST,1,0.00,test
12205,TEST,1,0.00,test
22206,TEST,1,0.00,test
32207,birria,2,11.00,delivered
NORMALLoading the editor…0.0s5:1

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

The mark comes back

gv highlights the last highlight again: after a stray Esc, or right after a verb, when you want a second verb on the same text. V2j> then gv> indents three lines two levels deep.

Check yourself

Which lines come back?

2a
1b
3c
1d
2e
3f
NORMAL
Keys pressed: Vj>gvd

You indent two lines with Vj>, then press gv and d. What is left?

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

Two levels deep

The three lines inside totals lost their indentation and need two levels. You had them highlighted, and a stray Esc just wiped it. Don't start over: bring the highlight back, >, and bring it back again for the second level.

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.

One stroke over a whole thing

Text objects work as the first stroke: vip highlights the paragraph you're in, vi" a string's contents, vit what's between two tags. You see the whole thing marked before you choose the verb.

Try it

Case backwards

Every letter of the note is in the wrong case. Highlight the paragraph and swap the case: vip then ~.

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

Ends and marks, from memory

Press the keys.

Highlight down a line, then hold the other end instead.
scroll here, then press the keys3 keys
1 of 4
Highlight down a line, then hold the other end instead.