reddit / emacs

Swapping Ctrl and Caps Lock only for emacs? On linux.

resixzem · 2022-01-27 11:00
Perhaps I misunderstood. But it seems the usual implementation of this common suggestion is to switch it everywhere. Is there a way to do it only for emacs? Do other non-GNU Emacs emacs has an option to switch it within the software? I use Arch btw. edit: Disabling caps lock probably makes more sense than swapping them. The often mentioned: `setxkbmap -option ctrl:nocaps`. Instead of the swapcaps option.
etuu · 2022-01-27 11:06
Do you... really *need* the Caps Lock key in the default location for any software? To be honest, Ctrl instead of Caps Lock is handy in every piece of software where Ctrl is used. I think most people that does this mapping does it globally. I don't see the point of having a Caps Lock at all.
iaeung · 2022-01-27 11:32
On caps key press check for current selected X window and decide what to send. https://stackoverflow.com/questions/2176532/how-to-map-caps-lock-key-in-vim Problem: how to send ctrl press and release it on actual key release? Other idea is to check on every window switch, and use usual implementation when it's to emacs, disabling when from emacs
resixzem · 2022-01-27 11:38
Looks promising. Thanks. It's this particular answer for people who are also interested in this. https://stackoverflow.com/questions/2176532/how-to-map-caps-lock-key-in-vim/46516955#46516955
whudwl · 2022-01-27 12:11
Most people who want to swap CTRL and Caps definitely want to do it globally.
[deleted] · 2022-01-27 12:34
[removed]
notaslowkoala666 · 2022-01-27 13:06
I swappes Ctrl and caps guys but I can't get used to it after so long
iaeung · 2022-01-27 13:52
I map hold of 2,3,4 keys to Meta, Ctrl, Shift, same mirrored for right hand. Comfy. Want to try?
ThockiestBoard · 2022-01-27 16:37
I have capslock on a second layer just in case, but can genuinely say ive NEVER used it since setting it that way lol.
samsjj · 2022-01-27 19:02
this is what i use and found it very useful in emacs,vim and terminal in general. change caps\_lock to control if pressed with other keys, or to escape if pressed alone. i have this via an app called karabiner elements on mac os.
thetemp_ · 2022-01-27 19:44
Not OP, but this idea sounds like a good one. I'm currently having space-bar double as control (tap-hold-next-release with delay set to 200). Normally it works great. But if I'm trying to type softly, it frequently gets interpreted as control when I intended a space. Numbers are typed far less often, so you've tempted me to try this out.
Second_Shift58 · 2022-01-27 21:35
do it globally.
xtifr · 2022-01-27 23:52
I'm not sure why you'd want to switch them *for* Emacs, let alone anywhere else! It makes it harder to switch between the Ctrl and Alt keys, which makes *lots* of things harder and/or less efficient. It's particularly bad when you want to do a C-M- modifier. And it really only makes a difference for keys on the right side of the keyboard in any case. It made sense to have the Ctrl instead of Caps Lock on ancient terminals that only had one Ctrl key, so you had to stretch to reach, e.g. C-t, but those haven't been common for decades. With a modern PC keyboard, C-t doesn't require any stretching, so why remap? It makes absolutely no sense to me. (I *used* to remap Ctrl to Caps Lock when I first started using PCs, but that was because I was *used* to those old terminals only had one Ctrl. Once I took a little time to get used to a second Ctrl key, I stopped remapping, and haven't looked back once.)
iaeung · 2022-01-28 00:22
Kmonad! I map tap of 2,3,4 as C-u, M-x, C-c (C-x hold); tab as shift. C-c key a'so adds C to all other keys while held. Right side is C-x, C-g, Esc. Space acts as number layer shift. Also every letter key is with 100ms delay, I'm able type 80wpm with few misholds. Old layout: https://github.com/kmonad/kmonad/blob/master/keymap/user/iaeerfung/uciea-rz.kbd
adouzzy · 2022-01-28 01:14
Agree. The best approach is to use muscle memory, don't use dynamic layouts. You would find you are actually slowing down doing so.
thetemp_ · 2022-01-28 02:45
Thank you for sharing that! Looks like a lot of good stuff.
[deleted] · 2022-01-31 17:31
[deleted]
trararawe · 2022-02-02 01:00
How do you type long upper case words (constants for example)? You keep shift pressed and type with 1 hand?
etuu · 2022-02-02 05:49
I have two shift keys, so I can use two hands. I even have a split keyboard so I notice those things. Otherwise, you can always just write it out lower case, select it and `M-x upcase-region`. Huh, apparently `M-u` is a default bind for `upcase-word` which would uppercase the following word.