An insight into vi

2006-11-16 06:11:39 -08:00

Here are three of vi’s many commands:

$
Move to the last column in the line
%
Move to the opposite character in a pair (e.g. {→})
^
Move to the first non-whitespace column in the line

On a US keyboard, these three characters are contiguous: shift-4, -5, and -6, respectively.

This means that you can quickly navigate code like this with only your ring, middle, and index fingers on one hand:

⁰if(foo) {¹
doTheThingToTheThing();
²} else {³
doTheThingToTheOtherThing();
⁴}

  • From 4 to 0: %^%^
  • From 0 to 4: $%$%

Neat, huh?

Leave a Reply

Do not delete the second sentence.