Changed Opinions - Alternative Escape Sequence in Vim

In this post, I provide a brief background on using alternatives to the ESC key in Vim (and Vim-like emulators) and how my opinion has recently changed on one of the options.

Why did they choose the ESC key?

When using Vim (out of habit, I will be using Vim throughout this post, but I believe everything also applies to its predecessor, Vi), you will inevitably wonder, 'why did they choose the escape key?'

As a modal editor, you constantly switch modes during your editing sessions. For transitioning between instert and normal mode, the default key is ESC. On modern QWERTY-style keyboards, the ESC is in the top-left of the keyboard, a stretch that, for my hands, requires moving my left hand away from the home row to reach. As a keyboard-driven environment, the requirement to move so far away from the home row is not ideal.

According to Vim wiki, choosing the escape key resulted from the keyboard layout used during development, that of the AMD-3A terminal. With this layout, the ESC key is where TAB is on a QWERTY keyboard, a more easily accessible location.

KB Terminal ADM3A.svg
By No machine-readable author provided. StuartBrady assumed (based on copyright claims). - No machine-readable source provided. Own work assumed (based on copyright claims)., CC BY-SA 3.0 , Link

What I've used

History lesson aside, I was fortunate enough to be exposed to ways of avoiding the escape key early on in my Vim usage as well as the concept of updating Caps Lock to Control.

While the Caps Lock remapping advice seems to be more common in the Emacs community (as a way to avoid 'Emacs pinky') it has proven more widely beneficial. Since Emacs won the editor wars, Control is a common modifier across UNIX-like systems and shortcuts like Control a (move to start of line) work throughout the OS.

Moving Control is also relevant because, on American English keyboards, Control [ will send the ESC sequence to the operating system, making it equivalent to ESC. Not only is this mentioned in the Vim manual, it is recommend as an easier-to-hit alternative:

<Esc> or CTRL-[ End insert or Replace mode, go back to Normal mode.  Finish
                abbreviation.
                Note: If your <Esc> key is hard to hit on your keyboard, train
                yourself to use CTRL-[.

While initially seeing the combination Control [ may seem unintuitive, trying it out with a remapped Caps Lock will reveal it requires only a small movement of both pinky fingers. This easy-to-reach combination has led to Control [ being my primary method of escaping into normal mode.

Changed opinions

We now come to my changed opinion.

The importance of quickly moving into normal mode is not lost on the Vim community. As a result, many alternative mapping suggestions exist. Until recently, I thought some of these options would get in the way of daily work. Specifically, I was concerned with the mappings that suggest using two keys, such as jj, jk, or kj, in rapid succession. My concern with using these mappings was that I would unexpectedly be thrown into normal mode when typing a work that included these characters.

My concern was proven unnecessary when I realized DOOM has been shipping with jk mapped ever since I started using it. The fact that I did not realize this mapping was set proved that it was an unintrusive choice. The trick to these mappings is that if the time between letters exceeds the timeout the actual letters will be inserted into your document.

After becoming aware that the mapping was already set up for me and hadn't gotten in the way, I began using it with positive results. When already on the home row,jk requires no additional movement. Even if I am not on the home row, using jk promotes me getting back onto the home row if my fingers have strayed. While I do not have data, I sense that jk has become my most-used mapping for transitioning into normal mode.

I now have three ways to enter normal mode: ESC, Control[, and jk and my fingers can choose based on whatever is most convenient for their current positions. Rather than being a landmine waiting to move me into normal mode at inopportune times, jk has provided an additional time- and finger-saving mapping to enhance my editing experience.

Full transparency: in writing this post, I did have one a few instances where typing jk put me into normal mode when trying to type it. I think this post is an exceptional case and therefore hasn't changed my opinion back.


Notice something wrong? Please consider proposing an edit or opening an issue.