:normal on ranges
:normal takes any Normal-mode keys for every line on the slip: :%normal␣A;↵, :g/./normal␣A;↵ to skip the gaps, a highlight with I// , or only the lines :g picks. Then you choose the tool.
Thursday, 4:30 p.m. The migration script for tonight: every UPDATE statement needs its ;, and a comment line in the middle mustn't get one. The examples file has a block of calls with the old names that should be commented out.
On Monday you handed a recipe card over with :normal @a. A slip can carry the keys themselves.
Warm-up from earlier chapters
Two from earlier chapters, from memory, before the new idea. Two wrong tries show the answer.
await.await.Keys as the order
:normal takes any Normal-mode keys, not only a card. :%normal A; presses A ; on every line of the file: each line starts fresh, at its beginning, in Normal mode, and an Insert left open is closed when the line is done. Put any range in front: %, a highlight, or :g/pattern/.
notify(courier)release(courier)log(order)notify(courier);release(courier);log(order);Semicolons everywhere
Lists of statements without their semicolons, every line of each. One slip each: :%normal␣A;↵.
This exercise needs a keyboard. Read on, and play it at your computer.
Blank lines too
You send :%normal␣A;↵ on three lines, the middle one empty. What happens to the empty line?
Not the gaps
This list has blank lines between its groups, and they should stay blank. Every line with something on it gets its ;: :g/./normal␣A;↵.
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.
On a highlight, or by what they say
Highlight some lines and : gives you '<,'>: :'<,'>normal I// comments out just those. And with :g in front, the keys run only on matching lines: :g/^UPDATE/normal A; gives each UPDATE its semicolon and leaves the comment line alone.
Comment the examples
The three example lines with the old names get // in front. Highlight them (2j, V, jj) and :normal␣I//␣↵.
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.
Only the statements
Every UPDATE line gets a ;; the -- comment doesn't. :g/^UPDATE/normal␣A;↵.
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.
Your tool
Two jobs, and the tool is yours: a block (Ctrl-v), a card, or :normal on a range or after :g. Before you press anything, say which lines and why that tool. Any route that leaves the right text counts.
Stuck? Show a hint
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.
Keys on many lines, from memory
Press the keys.
; to the end of every line.; to the end of every line.