开发者

Why use Esc in vim? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
开发者_Go百科

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 6 years ago.

Improve this question

The Vi editor was originally written on an ADM-3A terminal, which had the Escape key in place of the Tab key (compared to most modern keyboards). Many touch typists appreciate the fact that they can leave their hands on the keyboard home row while using Vim but the use of Esc makes it compulsory to leave the hands to press Esc. I am currently learning vim. Should remap Esc to somewhere else ? What is the most common remap for this case ? or should I leave the idea of remapping Esc and continue using it ? What do pro users of vim do ?


I have mapped Escape to otherwise unused Caps Lock. This is a common method to streamline vim's usage. This article has some alternative solutions, too. The same article links to tweaks to make the Escape-Capslock switch system-wide if you prefer.


An alternative for the esc key is CTRL+[ combination.
(This is a standard in VIM, no need to remap anything).

I use this shortcut all the time instead of Esc.

Also I remapped my caps lock key to Ctrl, that way it is even easier to type.


I have the key sequence jk mapped to Esc.

You might ask, so what happens when you come across a word with jk. No problem. Type j, wait for half a second and then type k. Yes, that's non-ideal but the advantages of not having to move your hands of home row is much more.

I highly recommend jk sequence as `Esc.

Other variations of the same idea are jj - which in my humble opinion wont work for me. I use j for moving down - as others.


I remap Esc to Caps systemwide.

In Linux:

Create a file ".Xmodmap" in your home directory, with the following content:

clear Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape

In Mac:

Download a program called "KeyRemap4MacBook" and remap tab to Esc.

Using other people's computer becomes a pain in the ass though. I'm such an environment tweaker that I look like my grandma on a standard setup :/


CtrlC also works for escape out of the box. I've got my Capslock key mapped to Ctrl as that's more useful to me in a number of situations.


I have personally remapped <ESC> to ii.

ito go in and ii to go out of insert mode is easy to remember.


I mapped mine with ;; and my right pinky finger is now aching, this is after a month of coding. I think it's a good decision to go with jj or jk.


I use Menu key instead of escape.

Details are here: How to map Menu key ("Application key") to Escape key in vim?


I rebinded capslock to control and right control to escape key, so pressing escape is just fine now.


imap jj <ESC>

Others like to map 'jk', or 'leader-j'. I don't use hjkl nearly as much as I should.


I've remapped it to my right ⌘ (mac keyboard) because it works always no matter what mode you're in or application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜