reddit / emacs
Mapping Ctrl to Caps Lock
LinuxTenderFoot · 2022-04-28 00:49
I'm new to emacs and I've seen multiple people suggest to map the ctrl key to caps lock.
I understand the concept, move ctrl closer to the keys, but since I use different keyboards and my work os is Windows and I don't have admin rights to the computer, would moving the ctrl key get confusing muscle memory wise?
chiraagnataraj · 2022-04-28 00:58
I used AutoHotKey when I was forced to use Windows to remap Ctrl to CapsLock.
harmoniusplunge · 2022-04-28 01:12
I don’t think muscle memory should be a huge problem. Usually the keybindings you use in emacs are different enough from any other program that the muscle memory shouldn’t hurt you outside of emacs.
If you use emacs enough, I think that the benefits of the switch outweigh any negatives.
LinuxTenderFoot · 2022-04-28 01:17
Thanks for the response, this is the first time I'd be altering the keyboard mapping and I guess I'm a bit gun shy. I've got a lot to learn but I think this will pay off in the end.
desgreech · 2022-04-28 01:28
I use this on Windows: https://github.com/ililim/dual-key-remap, and it works pretty well.
It shouldn't require admin rights (unless you want it to work on programs that were launched with admin rights).
I switched to this from AHK because of its occasional hiccups, which is intolerable for such a critical and frequently-used key.
00-11 · 2022-04-28 01:29
I'd say get used to Emacs for a while, and then decide whether you want to try such a switch.
There are lots of Emacs users who *haven't* made such a switch - whether or not they might have tried it for a while. (My guess is they'd even be the vast majority of users, but I have nothing to back up such a guess.)
Here's some food for thought - maybe something to keep in mind when wondering about all the advice you see to switch:
**You won't see posts from non-switchers**, advising people *not* to switch or telling people *how* not to switch. ;-)
ToranMallow · 2022-04-28 01:48
If you are training yourself to use Emacs via primarily the keyboard, make the switch. Who uses caps lock, anyways?
timmymayes · 2022-04-28 01:50
Also try hitting Ctrl with edge of your palm. I do that and never remapped.
LinuxTenderFoot · 2022-04-28 02:15
interesting...thanks for the info!
LinuxTenderFoot · 2022-04-28 02:17
**MIND BLOWN!!**
Thanks for the info!
xmcqdpt2 · 2022-04-28 03:03
On my personal keyboard I use Sharpkeys while at work I use keyboard that is onboard programmable.
I actually think mapping caps lock to control is a terrible idea because it encourages you to use only the left control instead of learning to use both modifiers properly. You should optimally use the control key with the other hand (so C-x = left hand X, right hand control), same as shift.
The remap that works best for me is to remap the modifiers to
Win - Alt - Ctl- Space -Ctl-Alt-Win
Then you can press both Ctl and Alt with your thumbs.
[deleted] · 2022-04-28 03:08
[deleted]
avindroth · 2022-04-28 03:20
Not what you asked, but I recommend getting an ergonomic keyboard. Key-chording wasn't feasible for me until I got my Kinesis, where I can press modifier keys with my thumb.
globalcandyamnesia · 2022-04-28 03:56
I think having both keys be ctrls is the best of both worlds. That way you can see for yourself which one is used more.
The caps lock key is pretty useless, so in terms of muscle memory it's a bit annoying to switch back and forth but it'll never cause critical errors.
harunokashiwa · 2022-04-28 03:59
[Sharpkeys](https://github.com/randyrants/sharpkeys) is a utility that manages a Registry key that allows Windows to remap one key to any other key.
IterativeSieve · 2022-04-28 05:04
I’ll provide a counterpoint: I have caps remapped to control, but I rarely use it.
However, I *never* accidentally turn on caps lock. For me, it’s worth it on that basis alone. Naturally I could just unbind it, but since caps is a dead key to me anyway it’s occasionally useful.
CorysInTheHouse69 · 2022-04-28 05:56
I rebind my bottom modifier keys instead.
WIN ALT CTRL SPACE CTRL ALT WIN
Now you can hit control with your thumbs rather than your pinky.
This also makes so much more sense outside of emacs bc control is by far the most used modifier key and win is by far the least (at least for keybindings). I’d go so far as to recommend this to everyone, even if they don’t use emacs.
kojogadget · 2022-04-28 06:07
I'm also a new emacs user. I also read the tips os switching caps to ctrl and I was sceptical at first. There were arguments that is was easier and more ergonomic, but what convinced me was this. The only downside is that is doesn't give you the opportunity to be an online screemer.
I didn't switch the keys, I ended up with replacing the caps with an additional ctrl. Now i can use both keys for the same purpose regardless of what program I'm in.
Camel-Bulky · 2022-04-28 07:31
Yes! Exactly the way I do it (but using qmk programmable keyboard instead of sharpkeys).
LostCake · 2022-04-28 08:50
I remapped left Ctrl to Caps Lock globally because my keyboard was broken. It took like one week to fully switch to new setup. Now I remap it on every computer I use.
LinuxTenderFoot · 2022-04-28 14:51
Thanks for the info! I don't have admin rights to the machines at work and that's the sticking point. Of course, I haven't submitted a ticket to do this yet, maybe it's something to consider. Thanks again!
LinuxTenderFoot · 2022-04-28 14:54
NICE! I like the online screamer reference! That's a different idea, though, shift will still be around and I kinda use that if I need a word capitalized normally.
Thanks for the info!
LinuxTenderFoot · 2022-04-28 14:58
hmmm...I'm glad I posted this, I didn't even think of that. I guess I adapt and the keyboard has gone through so many reconfigurations, I never thought to drive that reconfiguration.
Thanks for the info!
LinuxTenderFoot · 2022-04-28 15:01
Someone else mentioned this, I didn't even think of it. How many times have I put the caps lock on only to fail on my first 2 passwords attempts to unlock the screen? Answer: more than I care to admit to.
Thanks for the info!
00-11 · 2022-04-28 16:58
Some of the people who write text, including code samples in doc for languages where uppercase is commonly used for certain things.
A computer keyboard can be used for text of any kind, including any text for which typewriters were once used. And that goes for Emacs also. There's a reason why typewriters have a CapsLock key, and that reason applies to computer keyboards as well.
Many users of computer keyboards don't use that key. Many users also don't use several other keys. Fortunately, Emacs lets you do whatever you like with keys (for the most part).
ToranMallow · 2022-04-28 17:07
I suppose if OP falls into one of those categories, he could probably just switch caps with control, rather than making them both control like I do. Even if I'm writing SQL code, I tend to use the control key in Emacs way more than I would have ever used caps lock, so the reduction in wrist pain is worth it.
tdavey · 2022-04-28 17:44
+1 for Sharpkeys. However, modifying the Windows Registry will likely require admin rights in a corporate work environment.
thetemp_ · 2022-04-28 17:57
> Some of the people who write text, including code samples in doc for languages where uppercase is commonly used for certain things.
Ah, but that's why we have M-u, `upcase-region`, etc.
For me, CapsLock has caused more havoc in my life than any other key. So replacing it with Ctrl was a no-brainer. I still have to remember to use my ring finger to press it instead of my sad-weak-pinky, else I'll eventually start feeling some unwelcome tingling in that digit. But it's not as bad as the pain in my wrist from always using the Ctrl key in the bottom left corner.
Everyone's different. If it's working, stick with it. But I'd caution anyone that if you start feeling symptoms of RSI, don't ignore them. Adjust what you're doing quickly before it gets worse. Take more breaks, etc. Anyway, that's a tangent but an important point.
00-11 · 2022-04-28 19:13
> Ah, but that's why we have `M-u`, `upcase-region`, etc.
It's not because we have a hammer that there's no need for a screwdriver.
(Analogous to having a Caps Lock key even though we have `M-u` and `upcase-region`: we have `overwrite-mode`, and we bind it to `<insert>` by default, even though we also have `C-w`.)
----
It's about different use cases or different users, with different preferences and perhaps different keyboards.
So we agree about this:
> Everyone's different. If it's working, stick with it. But I'd caution anyone that if you start feeling symptoms of RSI, don't ignore them.
I'd go further, and advise to check with a doctor - not just swap use Caps Lock as a replacement for Ctrl.
xtifr · 2022-04-28 20:03
I have caps lock mapped to Compose instead of Ctrl. This avoids the annoying accidental all-caps mode *and* provides a useful feature, *but* one I can live without when faced with a different system.
xtifr · 2022-04-28 20:12
I actually recommend *against* remapping caps lock to control! It really doesn't help anything! With ancient systems that only had one control key, it could make something like C-t easier to hit, but on a modern keyboard, that's not even an issue! And, as you note, it can mess up your muscle memory when you have to use other machines.
More importantly, when I tried it, I found that it made it harder to switch between Ctrl and Alt, which can be really important for effective use of Emacs!
As for the problem of accidentally hitting caps lock, which a couple of people have mentioned, I solved that by remapping caps lock to compose, rather than control! :)
IterativeSieve · 2022-04-28 20:24
Not a bad idea at that. For me the primary use is eliminating the caps lock key and the extra function is a distant second. Compose isn’t a bad candidate at all.
thetemp_ · 2022-04-28 22:36
Yes, I think we agree mostly. Certainly if one has an ergonomic keyboard (with Ctrl keys in a better position), that's by far preferable to futzing around with the operating system's recognition of CapsLock and whatnot. (I thought I'd found such an option at one point, but sadly it turned out the price was reflecting of its quality. And I'm back to using a regular keyboard now.)
I'm not blaming Emacs's bindings for these issues at all, by the way. Legend, as it was related to me, is that control keys used to be located next to the "a" key rather than in their present position. So I see relocating CapsLock as a sort of return to the prior status quo.
But RSI, as the name implies, comes from "repetitive" stresses. I think the problem has more to do with the amount of and manner of use rather than the precise location of certain keys, though I do think that with heavy use (and perhaps bad form, that I probably have), rearranging keys can be beneficial.
You mentioned the Insert key and overwrite mode, which are a couple more pet peeves of mine. But I will step back, take some deep breaths, and not write a screed on those topics. ;-)
LinuxTenderFoot · 2022-04-29 01:24
Yeah, unfortunately, I'm sure I won't get admin rights to my machine.
LinuxTenderFoot · 2022-04-29 01:36
I was considering using split keyboard, but I wasn't sure that I'd be allowed to bring it into work and that really does require a different muscle memory set to use.
If you don't mind me asking, how much did this set you back? How long did it take for you to get used to the new configuration?
LinuxTenderFoot · 2022-04-29 01:42
Some great points! 2 others recommending not switching the caps lock but to have control in 2 different spots, that way you're still close to the Alt key.
I'm glad I posted this. I almost balked and didn't post, but I'm getting some great information! Thanks for responding!
avindroth · 2022-04-29 04:46
Like one or two days, go for it
aqjo · 2022-04-29 10:17
You might try kmonad. It doesn’t seem to need admin rights, but I just quickly read over a few things.
This might upset your IT people though, especially since it is reading keystrokes, it could be considered a threat.
https://github.com/kmonad/kmonad
LinuxTenderFoot · 2022-04-29 11:24
I'll check to see if that's allowed in work, they're pretty strict about the hardware that can be used on their computers.
What model do you recommend from Kinesis?
LinuxTenderFoot · 2022-04-29 11:28
Yeah, I think you're right. Someone recommended a split keyboard and I need to make sure I can use one of those before I make the investment. And software has to go through a vetting process before you're allowed to install/compile it.
But I appreciate the information regardless. Maybe someone else can benefit if they read this thread.
aqjo · 2022-04-29 19:35
Yeah, programmable keyboard would definitely fix this :-)
fragbot2 · 2022-04-29 21:29
While I have remapped the keys for my other keyboards, I also bought one of these: https://www.hhkeyboard.com/uk/products/pro2
Only thing about it I dislike are the arrow keys as they make it difficult to navigate org-mode's dates.
LinuxTenderFoot · 2022-04-30 16:42
I gotta still see if it's a possibility. Been on vacation this week, just finished up a project deadline in Windows (where most of my development experience has been). It is an interesting idea, though
LinuxTenderFoot · 2022-04-30 16:58
Thanks for the info! I'll be checking out these and a few more keyboards recommended