3 ms·
> inoremap jk <ESC> Using two keystrokes instead of ESC to leave insert mode is definitely a personal preference and not necessarily more efficient or comforta
by barbs 11y ago
> inoremap jk <ESC>
Using two keystrokes instead of ESC to leave insert mode is definitely a personal preference and not necessarily more efficient or comfortable.
- octref 11y agoHaven't used ESC since finding out Ctrl-C.
- steve_b 11y agobonus is that Ctrl-C gets you out of pretty much any mode. Also, while in insert mode, using ctrl-h for backspace and ctrl-w for delete word are really nice.
- ThatGeoGuy 11y agoBetter yet, ^[ is actually ESC in vi/vim, and works without a config change. I started using this last year and haven't looked back. ^C works well, but I recall it having some limitations in certain environments (though for the life of me I can't recall what they were). In any case, I prefer ^[ to ^C, and hopefully you will too!
- mikerichards 11y agoouch...as others have said, CAPS LOCK is your friend
- nrivadeneira 11y agoWhy is caps lock your friend? I can't think of any situation where it'd be more useful than another key such as ESC or my personal preference, CTRL.
- 0942v8653 11y agoWay more useful (for me anyway) is mapping Capslock to ESC. It works with any vi anywhere as long as you are using your main machine to connect. Also with inoremap don't you have to wait for the letter j to show up until you type your next character? That would drive me crazy. Edit now that I have actually looked at the article: Yes, you can map it to Control but for me it's an awkward place to put a modifier. What if you want to do Ctrl-A? Ctrl-C? At least the way I type, I'm better off using the one in the corner.
- cryptonaut 11y agoWas just about to post this. Though I map Caps-Lock to Esc through xmodmap so it works everywhere instead of just in Vim.
- barbs 11y agoI'd actually like to map Caps-Lock to ESC as well, but I'd prefer to make it vim-specific rather than system-specific, and there's no way to do that :(.
- bonquesha99 11y agoI have a similar remapping of Caps: * When I tap Caps, it's `<esc>` * When I hold Caps OR hit it in combination with any other key, it's `<ctrl>` It really feels like the best of both worlds. I primarily develop on OSX, so I use https://pqrs.org/osx/karabiner/ https://pqrs.org/osx/karabiner/ to handle the remapping.
- jagger27 11y agoOh man I had no idea Karabiner could do that. Thanks!
- tremendo 11y agoThis works great on my Linux machine. On the Mac though I hate that all Mac apps use Command for well, all command-key combinations instead of Ctrl, so I map the Caps-lock to Command instead, but while Karabiner can do the dual "Esc on tap plus other on hold" for Ctrl, Shift and Option keys, it cannot frustratingly do it for the Command key. ITerm can switch caps-lock back to Ctrl, but then I lose the Esc double function. It's maddening.
- berkes 11y agoI have this too, but it can be infuriating when: * I have to quickly explain something on my colleagues machine. * A colleague wants to show me something on my machine. The `<esc>` is, I daresay, one of the most ingrained keys when operating a computer. When you keep mistyping it, levels of stress will go up.
- colordrops 11y agoI prefer to avoid remappings so that I can use vim at any machine without having to figure things out, so my preference for escape is Ctrl-[. It takes a bit of getting used to but once you get it, left hand never has to reach up anymore.
- coryfklein 11y agoI wish I could use this, but Dvorak moves that [ just a little too high for this to be practical. :(
- andrewstuart2 11y agoIt's definitely more efficient. I've had it mapped that way for years, and after a short time it basically became a single keystroke. The efficiency doesn't come from the fact that it's not as far to reach. The efficiency comes from the fact that you don't have to find home row with your left hand again and can continue your command sequence immediately.
- nrivadeneira 11y agoI actually use jj for the same thing. It's so much better than using ESC.
- DoggettCK 11y agoOne of the best things I've done, though I personally use 'jf', since they've both got little nubs on the keys, and I occasionally have to spell "Dijkstra".
- function_seven 11y agoSame here. I did both jk and kj. When I want to leave insert mode, I just mash those keys.