Open Eyes Working Brain

dedicated, in respect and admiration, to the spirit that lives in the computer

The Vim Holy Grail

The Da Vinci Code is an engaging fictional detective story about a great historical deception. The dark con of man, perpetrated against humanity. The Holy Grail revealed to be nothing less than the ultimate proof of the deception and the key to set men free and change the world. It’s amazing how history can mislead people and how a single secret can debunk a long-standing myth. Vim is an old editor and the Vim community has long been a victim of such a myth: The Esc key. With Vim best strength being hand posture and efficiency of the home row, tons of Vim users have been wondering

Why the hell is the Esc key so awkward to type?

And even feeling the pain, most of them just kept using it as it is, because that’s how it was conceived so it must be right. Welcome to the Historian’s Fallacy. It’s that way but it was never conceived that way. Let me show you the Grail.

Terminal ADM-3A

This is a Lear Siegler ADM3A terminal, produced in 1975. The one used by Bill Joy while at Berkeley he developed the Ex editor and then Vi, starting since summer 1976. Now look at the Esc key. It was where today the very convenient Tab key is, just top left of the home row! That’s why he chose it. But with the need of typing escape sequences going down and down, it was moved …

IBM 5150 Keyboard

Here in the IBM 83-key keyboard (1981). And it was moved …

Model M

Here in the IBM Model M, second half of the eighties. Where it was left for the next almost three decades, in the very inconvenient top left of the keyboard. Control key had the same fate, just in the other direction. The two fantastic spots close to the home row were taken respectively by the Tab key and the Caps lock key. Now you know it was not meant to be that painful. That’s the great deception, but we can fix it by answering another one million dollar question

What the hell is the Caps lock needed for?

It turns out it’s even more legacy than Esc. It dates back to mechanical typewriters (gosh) as a lock for the Shift key. Needed because pressing the Shift key physically shifted the positioning of the typebars relative to the ink ribbon, so it was tiring. It’s a dinosaur that can be sacrificed to rectify the flow and there are two reasonable ways. You could remap the Caps lock to Esc, and that would be fine. But there’s an even smarter approach i highly suggest if you have an easy to type “[” key (like in the US layout):

Remap your Caps lock to Control and use Vim alternative way to Esc, that is Control + [

Caps lock (as Control) and “[” are keys very close to the home row, hit by different hands, so hardly more difficult than typing Caps lock (as Esc) alone. What’s nice is you can also benefit when typing those Control/something combos that are pretty common. This way you’ll get the best of both worlds and guess what, if you have a nice OS that’s gonna take just 30 seconds. For the others Google is your friend.