One Normal command
Ctrl-o lends you the remote for one press: one Normal-mode command, like zz, D or 0, and you're typing again where it left you.
Monday, 11:30 a.m. Second rehearsal. No typos stay on screen now, but the code you're typing creeps down to the bottom of the projector, and the people at the back can't see it. Every time, you leave Insert mode, press zz to bring the line to the middle, and go back in.
It's one Normal-mode command. You shouldn't have to put the typing down for it.
Warm-up from earlier chapters
Two from earlier chapters, from memory, before the new idea. Two wrong tries show the answer.
Borrow the remote for one press
Ctrl-o in Insert mode hands you the remote for exactly one command: the keys after it are read as Normal mode, and when that command is done you're back in Insert mode, typing where it left you. (At the end of a line the command starts from the last character, and the typing resumes at the end.) Ctrl-ozz brings the line you're typing to the middle of the screen and you carry on.
Off the bottom
You're typing a new line at the very bottom of the file, where the back row can't see it. Ctrl-ozz to bring it to the middle, then finish the line: === "rush"; and Esc. (This page checks the line you typed, not where the screen ended up: watch the screen yourself.)
This exercise needs a keyboard. Read on, and play it at your computer.
Drop the rest of the line
Halfway through a line you realise everything after the cursor should go. Ctrl-oD deletes from the cursor to the end of the line and leaves you typing. Or the line you're on should be a comment: Ctrl-o0 jumps to the start of it, and you type // there.
return total + legacyFee(order) + 0.5return total return total;total: Ctrl-oD drops the rest of the line, and the ; goes straight in.The rest goes
Each goal starts in Insert mode, mid-line. Everything after the cursor goes: Ctrl-oD, then finish the line as shown and Esc.
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.
Where does the typing go?
You type + tax at the end of the line, then Ctrl-o0, then // . What does the line say?
Comment it out
You finished typing each line, then decided it shouldn't run. Without leaving Insert mode: Ctrl-o0, // , Esc.
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.
When to just leave
Ctrl-o is for one command in the middle of typing. When you've finished typing and the rest is Normal-mode work, two deletes, a move, Esc is the better button: one press, and the whole remote is yours.
Done typing
Each goal starts in Insert mode, at the end of what you just typed. The rest is Normal-mode work: the debug lines go; the line you typed belongs above the other one.
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.
One press, from memory
You're in Insert mode, mid-line. Press the keys.