6 ms·
(Helpful tip) map caps lock to escape: https://vim.fandom.com/wiki/Avoid_the_escape_key https://vim.fandom.com/wiki/Avoid_the_escape_key
by dannycastonguay 6y ago
(Helpful tip) map caps lock to escape: https://vim.fandom.com/wiki/Avoid_the_escape_key https://vim.fandom.com/wiki/Avoid_the_escape_key
- the_jeremy 6y agoOr if you're on a locked-down computer because your office hates people, ctrl+[ works as well (and is portable to other people's computers)
- jrockway 6y agoYou can also do the remapping in hardware. Programmable keyboards are quite popular these days (I built one out of a $3 stm32f103), and they don't rely on the OS to help you do what you want to do. (This is a blessing and a curse. You never have to worry about OS-level hacks to make caps lock a control key, but on the other hand, there is no way in the USB HID protocol to say "send an !". Rather, the keyboard has to synthesize a shift + 1. And what character that actually maps to depends on your OS, because of course it does.)
- mahmoudhossam 6y agoI went one step further and swapped escape and caps lock keys on all my machines and haven't regretted it so far.
- ncmncm 6y agoI cannot remember the last time I wanted to use CapsLock--more than 30 years ago, anyway. By far the most irritating thing about others' keyboards is they have not disabled it yet. Second most is that Ctrl isn't there instead.
- Symbiote 6y agoHow do you TYPE_A_CONSTANT for the first time, or an ENUM_VALUE (perhaps somewhere you don't have autocomplete)? I keep a caps lock on my programmable keyboard for this (Fn+K). I also like SQL to be formatted with capital letters for keywords.
- Lio 6y agoEither using shift keys or: type_a_constant ctrl-[ vawU That sounds more than it is. Really I just touch type it without thinking consciously about it. Probably don’t even need visual mode that’s just how I work.
- californical 6y agoStrongly agree -- I mapped my whole keyboard to always have caps/esc swapped. It didn't take long to get used to. My left hand feels way better, not needing to reach very far. Biggest downside is using someone else's keyboard. I've grown a nasty habit of hitting escape instinctually, every time I finish typing something. I turn on their caps lock so regularly! Still worth it though
- jrumbut 6y agoI still get some mileage out of my caps lock key and use "jj" and use paste mode if I have to insert an uncommon string with "jj" in it. Usually pasting it anyway.
- war1025 6y agoI tried that `jj` or `jk` thing for a while and it just did not click with me at all. I tried it because I was having a bunch of wrist pain. The actual solution to my wrist pain was easy: Don't code on a laptop keyboard. The ergonomics are terrible.
- jtms 6y agoI strongly agree, but would go one step further and just remap caps lock to escape for the entire OS. Caps lock is a relatively useless function that takes up extremely prime real estate.
- Lio 6y agoMap caps to ctrl and you can get access to a world of convenient insert mode shortcuts. ctrl-[ (for right hand) or ctr-3 (left hand, thanks teddyh) => escape ctrl-i => tab ctrl-h => backspace ctrl-m => return ctrl-w => delete prev word ctrl-u => clear line ctrl-o => cmd mode for 1 cmd ...and many, many more, including all the completion options.
- alpaca128 6y agoI prefer Ctrl on Caps Lock and Escape on the original Ctrl. Works pretty well too.
- patrec 6y agoStill wasteful. Map Capslock to both Escape and Ctrl and never look back https://github.com/alols/xcape https://github.com/alols/xcape (for linux) https://apple.stackexchange.com/questions/132564/how-can-i-remap-caps-lock-to-both-escape-and-control https://apple.stackexchange.com/questions/132564/how-can-i-r... (for macOS) https://github.com/ililim/dual-key-remap https://github.com/ililim/dual-key-remap (for windows)
- austhrow743 6y agoWhat's the advantage to having control on it as well? Do people have trouble reaching the control key?
- patrec 6y agoTry it (or swap caps and control for day, to make sure you don't accidentally "cheat"). On most keyboards reaching the control key is very unergonomic compared to the capslock key. I wonder how many cases of RSI could be avoided by this simple tweak alone.
- matvore 6y agoI still use caps lock since I regularly code in POSIX shell, C, C++, and Perl, which all have naming conventions that use all-caps names. Also, as a VIM user, I only have to use Alt when I’m dealing with GUI apps, which is definitely common, but a time when I don’t mind moving my hands around. So for me, Esc is Alt. Alt is caps lock. And of course caps lock is Esc. And I swap Super key and Control, since the Super key is easier to press with my palm on my ergonomic keyboard. And Ctrl does have a lot of uses in Vim. I also map the Windows Menu key (not the Super key, but the other one which is used for showing context menus) To underscore. That helps me type C identifiers with multiple words in them. This one remapping is a huge benefit, almost as important as mapping caps lock to Esc.