4 ms·
The article mentions that you can set custom mappings to escape and uses this as an example: imap jj <Esc> If you're interested in doing that, I'd strongl
by bilalq 10y ago
The article mentions that you can set custom mappings to escape and uses this as an example:
imap jj <Esc>
If you're interested in doing that, I'd strongly recommend you never do a plain `imap` and instead always do `inoremap` (this advice applies to `nmap`, `vmap`, and the like as well). The difference is that the noremap variant is non-recursive [0].
Also, since we're on the subject of escape alternatives, I may as well mention mine. It really bothers me that exiting insert mode moves your cursor back a space. To remedy that, I've got a custom mapping that escapes and them jumps to the mark at which insert mode last was [1]. The mapping is:
inoremap jj <Esc>`^
[0]: http://learnvimscriptthehardway.stevelosh.com/chapters/05.html#nonrecursive-mapping http://learnvimscriptthehardway.stevelosh.com/chapters/05.ht...
[1]: http://vimdoc.sourceforge.net/htmldoc/motion.html#`^ http://vimdoc.sourceforge.net/htmldoc/motion.html#`^
- EduardoBautista 10y agoI'll go ahead and update it. Thanks for the info!