Fix it without leaving Insert
The typing keyboard has buttons of its own: Ctrl-h rubs out a character, Ctrl-w a word, Ctrl-u everything typed on the line, and you keep typing.
Monday, 9:00 a.m. The investors come on Friday, and the demo is you, on a projector, building a feature live. The first rehearsal goes fine until the first typo. You leave Insert mode, move back, fix it, come back in, find your place. On the big screen, the whole room watches the cursor go the long way round for one letter.
The keyboard in Insert mode has a few buttons of its own.
Warm-up from earlier chapters
Two from earlier chapters, from memory, before the new idea. Two wrong tries show the answer.
Buttons on the keyboard
In Normal mode the keyboard is a remote; in Insert mode it types. But the typing keyboard has a few buttons of its own, Ctrl chords that act instead of typing, so you can fix things without leaving Insert mode. Ctrl-h rubs out the character before the cursor, like Backspace. Ctrl-w rubs out the whole word before it. You keep typing straight after.
const eta = minutes + travleconst eta = minutes + const eta = minutes + rideTime(zone)travle. Ctrl-w rubs out the word, and you type the right one without ever leaving Insert mode.Wrong word, right away
Each goal starts in Insert mode, just after you typed a word wrong. Ctrl-w and type it again, then Esc.
This exercise needs a keyboard. Read on, and play it at your computer.
How much does it rub out?
You're typing at the end of return price + taxx and press Ctrl-w. What's left?
Take back the whole go
Ctrl-u rubs out everything you typed on this line since you came into Insert mode: the whole attempt, when the line went wrong from the start. What was on the line before you started typing stays. (If you didn't type anything yet, it rubs out what's before the cursor instead.)
What survives?
You typed const eta = minutes + a while ago. Now you press A, type ridtmie(zoen), see the mess, and press Ctrl-u. What's left on the line?
Start the line again
Lines that went wrong from the start. Each goal begins in Insert mode at the end of the line: Ctrl-u, type it right, Esc. On the last one, the start of the line was typed earlier and is fine.
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.
Which button?
Three buttons, three sizes of mistake. One character too many: Ctrl-h. A word typed wrong: Ctrl-w, and type it again. A line that went wrong from the start: Ctrl-u, and type it again. Pick the one that rubs out just enough.
Just enough
Six lines, each just gone wrong in a different way. Each goal starts in Insert mode, at the mistake. Rub out just enough, type the rest, 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.
Insert-mode buttons, from memory
You're in Insert mode, mid-sentence. Press the keys.
Rehearsal
The feature you'll build live on Friday, typed line by line. Each line has just gone wrong somewhere: fix it without leaving Insert mode, finish the line, Esc.
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.
Extra practice optional
The chapter is done. These rounds keep going as long as you like: stop whenever it stops being useful.
Typos, endlessly
Endless words typed wrong a moment ago.
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.