Learn Practice Daily golf Reference
Macros·Lesson 3 of 5·7 min·0/5 exercisesPro

Append and edit a macro

A card can be added to with qA, or laid out with :put␣a↵, corrected like any text, and put back with 0"ay$.

Scene

Monday, 2:40 p.m. The item list for the new menu: every item in quotes, with a comma after it. You write the card on the first line and only then notice it puts the quotes but not the comma.

The card is long, and writing it again is a chance to make a new mistake. A card is just text in a jar, and text can be corrected.

From memory

Warm-up from earlier chapters

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

Cook card a as many times as it takes, up to 99.
press the keys…4 keys
1 of 2
Cook card a as many times as it takes, up to 99.

Add a step at the end

Remember "Ayy adding to jar a instead of refilling it? Cards work the same way: qA (a capital) goes on writing at the end of card a. The classic use: you wrote a card and forgot to end it on the next line. qA j q adds the j.

Try it

The missing step

A bullet in front of each item: write the card (qa I - Esc q), notice it doesn't move on, add j with qA j q, then cook it on the other four.

Fix the marked spots · 5 left
1al-pastor
1veggie
2birria
3pollo
4tinga
NORMALLoading the editor…0.0s1:1

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

Lay the card on the table

To change a step in the middle, take the card out: :put␣a↵ puts its text on a line of its own, below the cursor. Correct it like any text. Then put it back in the jar: 0 and "ay$ copy the line, without its line break, into jar a, and dd clears the table.

AfterqaI"EscA"Escjq
"aI"<Esc>A"<Esc>j
The quote card in jar a: the steps, as text. No comma after the second ".
Try it

Correct the card

Four checkpoints, one list.

  • Write and test. The quote card on the first item (qa I " Esc A " Esc j q), then @a once on the second. Look: no comma.
  • Correct. G :put␣a↵ lays the card out; add a , after its second "; 0 "ay$ puts it back; dd clears the line. Then the two items you've cooked get their commas by hand.
  • Test again on the third item, with @a.
  • Apply it to the rest with a count.
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.

AfterqaI"EscA"Escjq:put a↵2f"a,Esc0"ay$dd
"aI"<Esc>A",<Esc>j
Jar a after the correction: the same steps, one comma more. Compare it with the card above.
Check yourself

With or without the line break?

1a
1b
2c
3d
NORMAL
Keys pressed: qaA;Escq:put␣a↵"ayydd@a

You put a card back with "ayy instead of "ay$. What does cooking it with @a do, compared with the card itself?

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

Cards, corrected, from memory

Press the keys.

Go on writing at the end of card a.
scroll here, then press the keys2 keys
1 of 3
Go on writing at the end of card a.