I like using inoremap jk <Esc> instead of inoremap jj <Esc>. It’s quicker to hit two keys in quick succession and it has the benefit of being mostly being a no-op in normal mode since you just go down a line and then up a line; which is nice if you have a nervous habit of returning to normal mode even though you might already be in it.
I am a big fan of using jk, and like you have never run into any issues where I need to type “jk” in insert mode. I recently switched to spacemacs, where they introduce a default of “fd” which I have found similarly ergonomic.
Hasn’t ever happened to me either. If it did, you would just have to hit j, then wait a second for the multi-key timeout to expire and the j to actually appear, then hit k.
some people remap jk and kj to esc so all you need to do is press both j and k at the same time to get esc. I am too used to jj to do that but you might want to try that.
There is, of course, the ever classic alternative: Caps Lock! Specifically, rebinding Caps Lock to Escape, or have it pull double-duty as both a control key and escape.
I haven’t upgraded to Sierra yet, but Karabiner Elementsmay work although a “double setup” for a key may not be supported. Am curious to hear how you get on.
That works pretty well, but I prefer to Control on Caps (with Backspace on left control, and Caps moved across to Backspace). Makes both chord-ing and editing easier in general. Still haven’t found a good place for Escape instead. Maybe switch with tilde? Just close enough to reach without moving my entire hand, far enough away to not knock?
When I first started using Vim, I mapped Caps Lock presses to Escape to avoid the awkward motion of hitting Escape with my pinky. But then I discovered a much easier technique for hitting the Escape key: rotate your wrist left slightly and press Esc with your middle finger. This technique replaced my need for the Caps Lock mapping, allowing me to use Caps Lock as I usually do – to type all-caps words such as “HTML” and RUBY_VERSION. I still hit Esc with that motion today, and find it quick and comfortable.
When I had that Caps Lock mapping, I implemented it with AutoHotkey on Windows and Karabiner/Seil on macOS. See this article for Mac instructions. I still use those tools, not for any Escape mapping, but for mapping Caps Lock to Ctrl only when pressed in conjunction with another key.
I have always hit Escape with my ring finger because my pinky is too short to reach without moving my palm, and it’s less rotation than using the middle finger.
Good reference for those trying to pay for a new MacBook Pro with touch bar. Literally my first thought when seeing it was, “But wait, how will I Vim?!”
Author here. That is exactly why I started sharing this article on other sites (luckily, it ended up here as well). I wrote it a couple of years ago but it seemed more relevant now because of the new Macbook Pro.
Author here. This blog post is a bit old but I decided to start sharing it on other sites once people started saying that Vim was ruined because of the new Macbook Pros. I stopped using <Esc> when I wrote the blog post and never looked back. Hopefully I have helped fellow Vim users use a better alternative to the <Esc> key.
I’ve tried many keys. My biggest problem with ESC was the lag and the movement of my left hand, which was never positioned above ESC. Later I’ve tried Ctrl+C and I’ve found it much more convinient to use than ESC. Still, I wanted to find something else; F10 could do the trick, but lots of terminals have problems with F keys (i.e. it can work directly, but not under ssh). Also some desktop managers like GNOME use F10 as a reserved hotkey. Not sure what’s the state of the problem now, but I remember being unable to free F10 from system binding. I’ve also tried Ctrl+Space, but it was also problematic in some terminals.
Now I am in the ‘jk’ camp as well. In Polish there are some words that actually use ‘jk’, but they’re rare, and I can always write ‘jaj<space><backspace>ko’ ;). Also, JK is “get out of insert mode and save the file”. ‘jk’ is nice, because it exits the insert mode and you are already prepared to move the cursor to a different place.
I like using inoremap jk <Esc> instead of inoremap jj <Esc>. It’s quicker to hit two keys in quick succession and it has the benefit of being mostly being a no-op in normal mode since you just go down a line and then up a line; which is nice if you have a nervous habit of returning to normal mode even though you might already be in it.
I am a big fan of using jk, and like you have never run into any issues where I need to type “jk” in insert mode. I recently switched to spacemacs, where they introduce a default of “fd” which I have found similarly ergonomic.
So doing that would cause typing ‘jk’ in insert mode to return you to normal mode? What would happen if you actually wanted to type ‘jk’?
In three years that I’ve used jk, it’s never been an issue.
That would change when someone invents texting integration into vim.
You need a small delay so that the chord doesn’t register, it’s about one second. So you type
j, wait a second, thenk.Please keep in mind this timeout is configurable via
timeoutandttimeout.Hasn’t ever happened to me either. If it did, you would just have to hit j, then wait a second for the multi-key timeout to expire and the j to actually appear, then hit k.
Me too! IMO, jj just doesn’t feel right… It will probably become more of a habit when I start using a new mbp.
some people remap jk and kj to esc so all you need to do is press both j and k at the same time to get esc. I am too used to jj to do that but you might want to try that.
There is, of course, the ever classic alternative: Caps Lock! Specifically, rebinding Caps Lock to Escape, or have it pull double-duty as both a control key and escape.
I used to use seil and karibiner on a mac to dual map caps lock - hold for ctrl, tap for esc - but those stopped working in Sierra.
Has anyone got those working?
I haven’t upgraded to Sierra yet, but Karabiner Elements may work although a “double setup” for a key may not be supported. Am curious to hear how you get on.
All the current solutions are hacky and haven’t worked very well.
I just map it to Ctrl and make Crtl-] my new Escape key.
Mind sharing your configuration? I don’t see a preset for that behaviour in Karabiner or Seil. (And I’m still using El Capitan :)
See here.
You can remap caps lock to escape directly in the settings in Sierra, no need for third party extensions.
That works pretty well, but I prefer to Control on Caps (with Backspace on left control, and Caps moved across to Backspace). Makes both chord-ing and editing easier in general. Still haven’t found a good place for Escape instead. Maybe switch with tilde? Just close enough to reach without moving my entire hand, far enough away to not knock?
is there a way to do this on gnome?
There’s a little program called xcape that does this.
That’s what I do, I never use caps lock anyway. :)
When I first started using Vim, I mapped Caps Lock presses to Escape to avoid the awkward motion of hitting Escape with my pinky. But then I discovered a much easier technique for hitting the Escape key: rotate your wrist left slightly and press Esc with your middle finger. This technique replaced my need for the Caps Lock mapping, allowing me to use Caps Lock as I usually do – to type all-caps words such as “HTML” and
RUBY_VERSION. I still hit Esc with that motion today, and find it quick and comfortable.When I had that Caps Lock mapping, I implemented it with AutoHotkey on Windows and Karabiner/Seil on macOS. See this article for Mac instructions. I still use those tools, not for any Escape mapping, but for mapping Caps Lock to Ctrl only when pressed in conjunction with another key.
I have always hit Escape with my ring finger because my pinky is too short to reach without moving my palm, and it’s less rotation than using the middle finger.
I always keep Caps Lock bound to Control, as it was meant to be.
I’m curious: if the Esc key is on the number row in the “UNIX” layout, what does the unlabelled key where Esc usually is do?
On classic Sun keyboards, it’s programmable. See, eg, this example.
Do you have a video or image of how your
escpressing technique works? I’m having difficulty visualizing this.I’m assuming you use a laptop most of the time? Because otherwise you must have a pretty large middle finger… ;)
Good reference for those trying to pay for a new MacBook Pro with touch bar. Literally my first thought when seeing it was, “But wait, how will I Vim?!”
Author here. That is exactly why I started sharing this article on other sites (luckily, it ended up here as well). I wrote it a couple of years ago but it seemed more relevant now because of the new Macbook Pro.
Author here. This blog post is a bit old but I decided to start sharing it on other sites once people started saying that Vim was ruined because of the new Macbook Pros. I stopped using <Esc> when I wrote the blog post and never looked back. Hopefully I have helped fellow Vim users use a better alternative to the <Esc> key.
I’ve tried many keys. My biggest problem with ESC was the lag and the movement of my left hand, which was never positioned above ESC. Later I’ve tried Ctrl+C and I’ve found it much more convinient to use than ESC. Still, I wanted to find something else; F10 could do the trick, but lots of terminals have problems with F keys (i.e. it can work directly, but not under ssh). Also some desktop managers like GNOME use F10 as a reserved hotkey. Not sure what’s the state of the problem now, but I remember being unable to free F10 from system binding. I’ve also tried Ctrl+Space, but it was also problematic in some terminals.
Now I am in the ‘jk’ camp as well. In Polish there are some words that actually use ‘jk’, but they’re rare, and I can always write ‘jaj<space><backspace>ko’ ;). Also, JK is “get out of insert mode and save the file”. ‘jk’ is nice, because it exits the insert mode and you are already prepared to move the cursor to a different place.
I’ve always used jj mapped to esc, but since reading this thread I think I’ll be giving jk a try.
…let’s see how muscle memory likes that.