Learn Practice Daily golf Reference
Text objects·Lesson 6 of 8·8 min·0/7 exercisesPro

Paragraphs and sentences

In prose the foil is white space: ip and is are a paragraph and a sentence, ap and as add the blank line or space after, so dap and das cut cleanly; ( and ) hop sentences.

Scene

Wednesday, 9:30 a.m. The kitchen's write-ups for the website arrive in menu.md: a paragraph per item, a few sentences each, and a few sentences too many. Your job is the editing.

Prose has wrappings too. You don't select a sentence; you name it.

From memory

Warm-up from earlier chapters

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

Delete the whole element, tags and all.
press the keys…3 keys
1 of 2
Delete the whole element, tags and all.

A paragraph in its foil

You met paragraphs in the long file: lines between blank lines, the stops for { and }. ip is a paragraph's filling, its lines. ap is the paragraph in its foil, which for prose is white space: the blank line after it. So dap removes a paragraph and leaves exactly one blank line between its neighbours.

ip
# Today's menu
Al Pastor is pork, marinated overnight with chilli and
pineapple. It's our best seller. Order it spicy.
Carnitas is pork shoulder, slow-cooked for six hours.
Crisp edges, soft middle.
Garden Veggie is black beans, peppers and rice. It's vegan.
Nobody believes it.
ap
# Today's menu
Al Pastor is pork, marinated overnight with chilli and
pineapple. It's our best seller. Order it spicy.
Carnitas is pork shoulder, slow-cooked for six hours.
Crisp edges, soft middle.
Garden Veggie is black beans, peppers and rice. It's vegan.
Nobody believes it.
The paragraph, then the paragraph with the blank line after it.
Try it

Junk paragraphs

Placeholder paragraphs dropped into the Markdown files. dap from any line of each one.

1 of 4Fix the marked spots · 3 left
1# Byte Burrito
1
2Burritos by e-bike, mostly on time. Orders open at 11 and close at 23.
3
4## Delivery
5
6Lorem ipsum dolor sit amet,
7consectetur adipiscing elit.
8
9Riders pick the nearest order first. If nobody is within 8 km, the order is refunded.
10
11## Menu changes
12
13Lorem ipsum dolor sit amet,
14consectetur adipiscing elit.
15
16Prices change every morning. Edit menu.ts, never the database.
NORMALLoading the editor…1/40.0s1:1

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

Sentences

To Vim a sentence ends at a ., ! or ? followed by a space or the end of a line, and it can run across lines. is is the sentence, from its first letter to its full stop; as adds the space after it. das deletes a sentence cleanly from the middle of a paragraph; cis rewrites one and keeps everything around it.

is
Al Pastor is pork, marinated overnight with chilli and
pineapple. It's our best seller. Order it spicy.
as
Al Pastor is pork, marinated overnight with chilli and
pineapple. It's our best seller. Order it spicy.
The sentence, then the sentence with the space after it.
1Al Pastor is pork, marinated overnight with chilli and
2pineapple. It's our best seller. Order it spicy.
1
NORMALLoading the editor…2:18
Try it

Fewer words

Al Pastor's last sentence goes (das), Carnitas gets a better second sentence (cis), and Birria loses the sentence about simmering. That last one has an abbreviation in it: after the first das, look at what's left before you go on.

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.

Check yourself

The last sentence

1Birria is beef stew. It comes with broth.
1
2Carnitas.
NORMAL
Keys pressed: das

The cursor is in the last sentence of the paragraph, and nothing follows it on the line. You press das. What is left of the line?

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

Sentence by sentence

) hops to the start of the next sentence and ( back to the start of this one (or the previous). Handy for reading prose a sentence at a time, and for getting into the sentence you want to change.

1Al Pastor is pork, marinated overnight with chilli and
1pineapple. It's our best seller. Order it spicy.
2
3Carnitas is pork shoulder, slow-cooked for six hours.
4Crisp edges, soft middle.
5
NORMALLoading the editor…1:1
From memory

Prose, from memory

Press the keys.

Delete this paragraph and the blank line after it.
scroll here, then press the keys3 keys
1 of 5
Delete this paragraph and the blank line after it.
Challenge

Copy edit

Ten junk paragraphs and doubled words across the Markdown files.

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 kitchen’s write-up

10:15. The kitchen's draft, top to bottom: "It's our best seller" has to go, the TODO paragraph goes, the sentence about 2019 goes, and "Nobody believes it." becomes "Even meat-eaters order it."

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.

Extra practice optional

The chapter is done. These rounds keep going as long as you like: stop whenever it stops being useful.

Endless

Prose, endlessly

Endless junk paragraphs and doubled words in the Markdown files.

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.