Quick Vim Tip – ESC Alternative
Posted by Jon Lee in Efficiency, Linux, tags: Efficiency, esc, Launchy, text editor, Trackpoint, vim
Here is a quick tip on my favorite text editor, Vim. Vim is very efficient at what it does once you get the hang of it. However, one of the bottlenecks for efficient Vim coders is the use of the Esc key to get out of Insert or Visual mode.
After typing a chunk of code, you have to move your fingers out of position to hit the Esc key and in a single editing session, this happens many times. Keeping your fingers in position is highly efficient and is also why I prefer the IBM Trackpoint over trackpads.
Recently, I experimented with using other keys as an alternative to Esc for moving out of insert and visual editing mode.
Default Alternative
Ctrl-[ (Control + left bracket) performs (essentially) the same function as Esc by default and doesn’t require any configuration so if you can get used to this combination, you can use it on any machine.
Custom Alternatives
You can also map your own key to perform the same function as Esc. For example, a popular choice is Alt-Spacebar. I use this for Launchy though so I’m sticking with Ctrl-[ myself. Here’s the code required to map Alt-Space to the Esc key.
inoremap <M-Space> <Esc>
Anyone have their own favorite alternative to the Esc key in Vim?
Popularity: 7% [?]
Entries (RSS)