6 ms·
Question for Vim users: how do you get used to hitting Esc very often? I know some switch Cap with Esc but still clunky.
by markus_zhang 5y ago
Question for Vim users: how do you get used to hitting Esc very often? I know some switch Cap with Esc but still clunky.
- sbankowi 5y agoI type using my old Sun keyboard still. The escape key is where the tilde key is on normal US PC keyboards. So the pinky stretch is quite easy. (Also the control key is where the caps lock is. Also another fine position.) :)
- nabogh 5y agoI've bound it to double J in my vim configuration file. First thing I do on every computer.
- kiwijamo 5y agoI've just got used to over time. It's gotten to the point I accidently use vi keybindings in other applications. Luckily there's keybindings in common applications e.g. typing / followed by a search phrase works in Firefox as it does in Vi which is pretty cool.
- danhab99 5y ago
- dosethree 5y agohow is using cap clunky? works great
- ambrose2 5y agoNot a great answer, but I switched Cap with Esc and it took several months before I was hitting Esc automatically like you might Ctrl + s a document when stopping typing.
- krat0sprakhar 5y agoI use `jk` or `jj` instead of esc. Its so much easier imap jj <ESC>
- knowledge-clay 5y agoI tried this, but it (understandably) caused a delay whenever I typed j alone in insert mode
- jazzabeanie 5y agoYeah, you get used to that.
- csomar 5y agoIt only matters if you are tying "jj". If you are typing "just", it's just as fast and the "delay" is just visual.
- xigoi 5y agoYou can map both jk and kj to Esc, which will allow you to press both of them simultaneously. Then you can set your timeout quite low when in insert mode.
- soraminazuki 5y agoDoom Emacs had this behavior by default, and it caught me by surprise when it prevented me from typing "noto-fonts-cjk." I knew a lot of people do this in Vim, but it took some time to figure out exactly what had happened. Excellent framework though.
- rbonvall 5y agoI've been using this mapping for so long and it's so ingrained in my brain that I completely forgot about it. It used to happened that I'd start typing jjjjj into a textarea or a word processor, and it took me a while to realize what was wrong.
- edenlinger 5y agoI use either karabiner on my laptop or map it in my keyboard firmware (mostly drive QMK boards for the last few years) to swap caps lock to escape on tap and control on hold. Makes vim life great. Also means that using ctrl+a as a tmux leader is comfortable to type.
- legogt 5y agoOnce I found out CTRL-[ did the same thing I haven't hit ESC since.
- asicsp 5y agoI wish Ctrl+[ wasn't tied to Esc. I hit that often instead of Ctrl+P. Haven't yet found a way to map Ctrl+[ to Ctrl+P without affecting behavior of Esc as well.
- ckolkey 5y agoIt's because your computer can't tell the difference. c-[ and ESC send the same key-code. Same with c-i and tab. What you can do to get around this is to remap one of them to something like f20 using Karabiner, then map f20 to what you like in vim.
- asicsp 5y agoThanks. Not sure if Karabiner is available for Linux, but I found https://stackoverflow.com/questions/41364833/karabiner-for-linux https://stackoverflow.com/questions/41364833/karabiner-for-l... which might help me.
- VTimofeenko 5y agoCan recommend interception-tools mentioned in that SO link. I have been using them for quite a while, remapping caps to escape in desktop environment agnostic way.
- chrismorgan 5y agoI’ve never found a problem with it. Right at the corner, it’s easy to hit with my left ring finger, sitting perfectly at a comfortable distance (based on where I rest my hands) for a slap in that general direction. (I use my Caps Lock as Backspace. Backspace near the top right is vastly less comfortable to reach than Escape in the top left.)
- afarviral 5y agoDisagree with Esc being in a good spot but having dabbled with the "workman" keyboard layout can confirm its quite lovely having backspace as caps. I often wonder about making capslock backspace, and original backspace becoming Escape. Since I already have strong muscle memory to stretch to backspace...
- avgcorrection 5y agoThat’s how I use Escape too in Evil Emacs/Spacemacs. There is some funky default in Spacemacs where you can hit something like d+f in rapid succession in order to enter normal mode but I didn’t find it to be worth it. People really like the home row but (1) I think it is fine to leave it once in a while and (2) my joints don’t like stay in a very static position for too long in any case.
- airstrike 5y agoEsc is probably the easiest key to hit in the keyboard? Tied with bottom left ctrl/fn and whatever you have in the other two corners. As in it's the easiest to misclick without accidentally hitting other keys
- the_gipsy 5y agoThe easiest are F and J, the home keys where your index fingers rest. The more you have to "reach away", the harder it is to always correctly reset your hand.
- afarviral 5y agoIts the weakest part of the vim keyboard scheme IMO for ergonomics, and switching modes in general. I wish there was an alternative that gave a nod to vim but remained in 'input' mode without loss of capability, you know...without having to be vscode. If the key layout wasnt even worse, and it wasn't a bloated mess (on windows at least) I'd have switched to Emacs. Capslock is mostly a redundant button so I wholey support remapping it and for me is the only sensible way to use vim, binding to jj is hacky and plays up often and is inefficienct, and ctrl+] is insanity for such a regular press. Caps as Esc is useful in games when remapped to esc too for speedy pausing or simply pressing it by accident to kill you in a gunfight lol struggles
- usrbinbash 5y ago> I wish there was an alternative that gave a nod to vim but remained in 'input' mode without loss of capability Problem is, without modes, we lose capability that comes from the fact that modes exist, such as simple characters being compositeable commands; How should a non-modal editor know whether that [d] I just pressed is me wanting the letter `d` or the delete command? It can't; Either I have to somehow tell it "the next letter I press is to be interpreted as a command", or "interpret what I press as commands until I say otherwise". The former gets tiresome rather quickly (what if I have to do several commands?), the latter would again be a modal editor.
- Lio 5y agoNow I wouldn’t do this myself but… If you want stay in insert mode most of the time you could use Ctrl-o to switch to command mode for a single command and then be immediately returned to insert mode. Eg Ctrl-o de To delete to the end of the current word. Again, I definitely wouldn't do it that way but vim makes pretty much everything possible.
- assbuttbuttass 5y agoI actually use Ctrl+[ instead of escape. It takes some getting used to but it's easy to reach
- wildrhythms 5y agoRebind Caps Lock to Escape (or as a second escape). Can't live without it now.
- apocolyps6 5y agoDo you consider hitting enter/return for a newline to be clunky as well? Its generally the same size as caps lock and opposite it on the keyboard. I'd say I press return a bit more often then Esc when using vim, but its close
- cturtle 5y agoTime. It slowly becomes second nature and now I quickly reach for esc in many applications, not just vim. It does seem weird at first, an insert key (i, a, o, etc) and an esc needed for every text addition, but over time you grow used to it. I also have my caps mapped to both ctrl and esc. Ctrl when held, and esc when tapped. Wish I had done that ages ago.
- ninepoints 5y agoAside from the advice mentioned (I bind caps to escape), I find that beginners use escape waaaay more often than is necessary because they aren't using all the commands at their disposal. For example, entering insert mode to delete some characters instead of using d+motion or x. Or entering insert mode to add indentation instead of using the = operator. It would take too long to enumerate all the cases where there is a much more streamlined way to perform an operation than entering insert mode, but I think this would explain the difference in experiences between people that may have used longer and aren't bothered by escape-use frequency and newer vim users.
- markus_zhang 5y agoThanks. This is helpful. I never use those shortcuts and yes most of my Esc are for indentation and deletion.
- shagmin 5y agoIndentation is a good example where insert mode isn't needed. Just do stuff like 5>>
- that-whiny-boi 5y agoI use ctrl+c. Since I'm already used to ctrl+c while using a terminal, it became easy even in vim. By default vim goes to normal mode when you press ctrl+c
- ZeroGravitas 5y agoI mentioned in another comment that I used to do this, note there are some rare cases when it's not the same as esc. You can remap Ctrl-c to be exactly the same though.
- hsx 5y agoI don't. I use Ctrl-C instead.
- the_gipsy 5y agoCaps as Esc works like a charm outside of vim too!
- johncoltrane 5y agoWe simply do get used to that and all the rest. The benefits of modal editing far outweigh the eventual clunkiness of pressing a given key now and then. But the more you know how to use Vim, the less you need to get in and out of insert mode and the less you need to hit <Esc>.
- tuxlifan 5y agoOn my Ultimate Hacking Keyboard I have a mapping of (left)space+q to produce Esc which for this combo I hit comfortably with my left hand thumb + ring finger. On other keyboards I find fishing for the Esc key with the left ring or sometimes even middle finger good enough since it's so prominently singled out on the top left corner on all the keyboards I had yet to use, but it breaks the flow a bit more. It probably helps that I'm not typing in proper form for the 10-finger system but only some hodgepodge approximation of it...
- sundarurfriend 5y agoCaps Lock being Esc is so convenient that I use Esc a lot more outside of Vim too. Stop the browser loading a page? a quick pinky tap on the caps lock. Take the focus out of a text field (so I can use my Vimium commands)? tap the caps lock. Decide not to save or open that file after all? caps lock's got your back. The remapping was originally for Vim, but now at least a third of my Esc usage is outside of it.
- chestervonwinch 5y agoAgreed! But it's a frustrating experience when you find when a website or application doesn't implement Esc for what you find to be nearly standard behavior across other applications. E.g., it seems like 80% of lightboxes allow closing via Esc.
- usrbinbash 5y agoMuscle memory. It feels clunky at first, especially when coming from a non-modal editor, but I hardly realize I am even doing it any more.
- ZeroGravitas 5y agoI remapped caps lock, to be control when you hold it and escape when you use it alone. However, for a long time I used Ctrl-c instead of escape, which is 99% the same except in some odd corner cases (not recommending that, just mentioning my history). These days I use the common vi tweak of 'jk' being mapped to escape.
- Lio 5y agoFirst I “live” in command mode and only visit insert mode to …insert stuff afterwards which I always leave with escape. So using vim becomes a series of small edits. I map caps to Ctrl and use Ctrl-[ for escape. That means I can still use Ctrl for insert mode shortcuts such as Ctrl-w (delete last word) Ctrl-r to insert a register (eg Ctrl-r% for filename) Ctrl-h instead of reaching for backspace. There’s loads of them. It just takes a bit of muscle memory but if you’re a touch typist it’s well worth it IMHO. Doing it this way, rather than say ‘jk’ in insert mode, also has the advantage of working in other vim-like programs where you’d have to repeat the mapping. If that’s even possible.
- xaxaxb 5y agoCtrl + [
- tharne 5y agoI use a programmable keyboard with thumb keys, similar to the ergodox. I have escape set to one of the thumb keys so that it's no more work than hitting "space".
- fellellor 5y agoIt’s pretty easy if you don’t think about it too much.
- rasengan0 5y agoEsc ? Never. Got so used to Alt-l