Mission 05 / 52• Insert Like a Pro

Uppercase Commands

In Vim, almost every lowercase movement or command has an uppercase twin.

Shift acts as an amplifier or directional inverse. While lowercase keys often perform local, one-step actions, uppercase letters take the action to the extreme or opposite direction.

Uppercase multipliers

  • Iinsert at the beginning of the line (before first non-blank character)
  • Aappend at the very end of the line
  • Oopen a new line ABOVE current line
  • Ddelete from cursor to the end of the line (d$)
  • Cchange from cursor to the end of the line (c$)

Remember: uppercase commands are fast lanes that avoid multiple cursor hops.

1
function calculateTotal(items) {
2
const sum = items.reduce((acc, x) => acc + x, 0)
3
return sum
4
}

Try adding a semicolon at the end of the return statement: move your cursor anywhere on `return sum`, press capital `A`, type `;`, and press `esc`.

Notice you didn't have to step across the line character by character. Capital `A` takes you straight to the end in one leap.

Tip: Whenever you find yourself pressing `l` or `w` repeatedly to reach a line boundary, stop and ask: can I use I or A instead?

Now it's your turn!

  1. Navigate to each green target across the code snippet.
  2. Use the motions and techniques learned in this lesson to land accurately on each target.
  3. See how fast you can complete 10 targets.
0/10
1
function calculateTotal(items) {
2
const sum = items.reduce((acc, x) => acc + x, 0)
3
return sum
4
}
NORMAL
00:00