5 ms·
When I was first introduced to Vim I thought : Modal editing is a great idea! I also thought why the hell do I have to hit Esc to get into normal mode!? You co
by cassepipe 5y ago
When I was first introduced to Vim I thought : Modal editing is a great idea!
I also thought why the hell do I have to hit Esc to get into normal mode!? You couldn't make a key further for the home row. So I refused to use it for a month until I stumbled on a Reddit post on how to swap the Esc key and Caps Lock :
"setxkbmap -option caps:swapescape" on Linux. Somewhere in the settings for MacOs.
For Linux you don't have to swap, there are other clever options.
Turns out that Esc on old "Unix" keyboards use to sit where Caps Lock is on modern keyboards
Another popular option is to have "jk" switch to normal mode as you are unlikely to need to insert that combination of letters.
How almost all introductions to Vim do not mention that historical fact and the fix for it, is beyond me.
- peakaboo 5y agoI use Ctrl-c instead of esc, works really nice for me. I prefer it to jk actually. But that's the thing, choice. That's the best thing about our tools and operating systems. Respect for the user choice.
- cassepipe 5y agoI am all for choice. But the default is just plain bad and introductions generally don't even mention Ctrl+c
- dwmbt 5y agoi think that's what first turns people off from vim. the defaults are (subjectively) terrible from an ease-of-use perspective. usability wise, nothing beats it. maybe emacs competes, but i've never given it a go. i think most introductions would do well with showing people how to change their configurations first. that's why i use neovim anyway. i took a unix course my third semester at uni and we had an entire 2 weeks dedicated to vim and how to feel more comfortable in our environments. we were only allowed to ssh into our development environments and the professor noted he's had a lot of success after ensuring everyone felt a-okay at the command line. at the end, we had an extra credit assignment where we got to show off our configs and present to the class why we made the choices we made. some kid even got me to start using some cool plugins (goyo, if i remember correctly), he introduced me to neovim!
- dwmbt 5y agocrtl-m for me! i like to map my keys with the keywords i have in my head (control + Mode). i really like how you put it in that last sentence. though i main my macbook for development purposes, my daily driver is a linux machine. i never really knew why i liked it other than i like to fuck around with different distributions... now that i see it in words, i like that the OS respects my choices. if i want to change something, i can. it's not impossible on MacOS, it's just sort of disrespectful how difficult it is to customize your experience!
- gnubison 5y agoFor others reading this, binding ^M and Ret separately will only work in a GUI, since they send vim the same bytes in a terminal.
- sodapopcan 5y agoPosting to say that I don't recommend ctrl-c without understanding that it's not equivalent to esc. From the docs: > Quit insert mode, go back to Normal mode. Do not check for abbreviations. Does not trigger the InsertLeave autocommand event. If you don't use abbreviations then there but if insert-based plugins aren't working as described, this may be why. Of course you can solve this with `inoremap <c-c> <esc>`.
- chockchocschoir 5y agoSwapping caps lock for escape is something that I first started going because of Vim, but now can't live without, in every context! I even started using it on other operating systems, even if I don't use Vim on them (mostly Windows and macOS), because it's so useful. Only trouble are in some games on Windows where the developers seems to have hardcoded the game to react to the actual Escape key instead of the key in the operating system, so pressing Caps Lock has no effect, and pressing escape does show the pause menu but also turns on caps lock (as I have it switched). Other than that, life is much better with them swapped.
- sundarurfriend 5y agoI just have two escape keys - the actual key and Caps Lock. Do you find that you actually use Caps Lock for anything?
- chockchocschoir 5y agoOn Linux, not really. Sometimes I disconnect my keyboard and reconnect it again, so the swapping gets restored, and I accidentally hit Caps Lock AND EVERYTHING IS BIG NOW. THEN I RUN THE SWAP COMMAND AND I'M NOW STUCK IN CAPS LOCK MODE unless I could just hit Escape again, which if I didn't swap, I couldn't. Jokes aside, it's mostly on Windows I have use for caps lock as some games I play use that key for things, so it's handy to have it swapped instead.
- scns 5y agoI do, for names in CONSTANT_CASE. But i use the Neo layout, where you press left + right Shift for Caps lock functionality. The Caps lock key itself is the modifier to reach layer 3.
- barbs 5y agoSame here! I primarily use linux and MacOS and have bound caps lock to escape for both of them. I rarely miss caps lock, it's better to keep your voice down online anyway ;)
- Finnucane 5y agoBut I've already swapped the caps lock for the ctrl key!
- teeray 5y agoUsing Karabiner Elements, you can have tap for escape, hold for control. After about a decade of experimenting, I’ve basically decided that that is how the Caps Lock key should actually function. The real escape key is the one that should be Caps Lock
- sodapopcan 5y agoI do this and it's really great. I don't understand how people live with hitting ctrl-c in the default layout of a mac keyboard. It's so uncomfortable.
- themadturk 5y agoI remap jj to esc. Right on the home row, completely independent of OS and keyboard layout. I can barely find the control key on a Mac...
- sodapopcan 5y agoOh ya, I'm a jk person myself. But for the times I need esc (even outside of vim) it's tap Caps Lock for me!
- cassepipe 5y agoThere was a post on HN once for a hack to do the same on Linux Found that : https://www.dannyguo.com/blog/remap-caps-lock-to-escape-and-control/ https://www.dannyguo.com/blog/remap-caps-lock-to-escape-and-...
- Finnucane 5y agoToo bad it is Mac only, no Linux support.
- 5y ago
- auto 5y agoI had the same issue, and I've found that most people haven't discovered that ctrl+[ is the same as hitting the escape key, and doesn't require any custom config.
- opan 5y agoI always found this advice annoying (and I actually do see it in many vim introductions) and didn't find it particularly bad to reach for escape, but I have mostly used 60% keyboards for many years now, so esc is one row lower than normal (where the ~ key is on a fullsize). Asking people to remap keys feels pretty major, but also there are many things people tell you to replace capslock with. I personally think making it a compose key is a better choice.
- cassepipe 5y agoThe useless context menu key is for me the best compose key
- weaksauce 5y agoif you have jk and kj set to escape all you have to do is mash them at the same time and it works without fail and it's quicker than pressing capslock to escape. well worth the change. and the rare times i need to use j or k next to each other you just press it slower... it's only been a pretty rare thing.