5 ms·
Remapping caps lock to control is one of the best things I've ever done in terms of configuration (along with switching to a tiling window manager). I'm not ev
by groovy2shoes 10y ago
Remapping caps lock to control is one of the best things I've ever done in terms of configuration (along with switching to a tiling window manager). I'm not even (primarily) an emacs user, but have been a vim user for over a decade. It wasn't even an awkward switch -- it felt natural almost immediately, and I never get any kind of finger or wrist pain anymore. I do it on all of my systems. Here's a cheat sheet:
X11: Stick `setxkbmap -option 'ctrl:swapcaps'` in your ~/.xsession (if using a display manager), ~/.xinitrc (if using startx or xinit), or your startup programs if you're using a fancy-schmancy desktop environment.
Linux vtty: Run `loadkeys emacs.map` (provided it's available in /usr/share/kbd/keymaps/). It's a good idea to stick this in your rc.local or rc.conf.local or whatever the hell the systemd equivalent is.
OpenBSD vtty: Run `kbd us.swapctrlcaps` (there are similar variants for uk and some other keyboards). To make it "permanent", `echo 'us.swapctrlcaps' >/etc/kbdtype`.
OSX / macOS: There's a dropdown menu in the System Preferences under "Keyboard & Mouse".
Windows: You'll need to edit the registry. Follow the instructions here: http://superuser.com/a/916887 http://superuser.com/a/916887 .
I don't have info for other systems handy, but it's most likely just a quick Google search away.
- qwertyuiop924 10y agoemacs.map is a thing? I used to just edit the keymap by hand. It was... unpleasant. So thanks for that.
- groovy2shoes 10y agoIt is on Slackware, at least! :)
- qwertyuiop924 10y agoI'm on arch :(.
- groovy2shoes 10y agoIs Arch missing emacs.map?
- qwertyuiop924 10y agoNo, it has it. I just didn't know that when I wrote the above comment.
- JdeBP 10y agoIt's not a very good cheat sheet. I recommend something like https://emacswiki.org./emacs/MovingTheCtrlKey https://emacswiki.org./emacs/MovingTheCtrlKey instead. Whilst that has its share of problems, such as getting Linux and NetBSD mixed up, it's better. It's actually a bad idea to stick a loadkeys command in /etc/rc.local, since that's a system that van Smoorenburg rc itself superseded, back in the 1990s. It's between 2 and 4 init/rc system overhauls in the past, at this point. It also has no guaranteed ordering relative to native mechanisms; and on many systems there are native services that configure the kernel's terminal emulator. And /etc/rc.conf.local is a configuration settings file that largely hasn't been around on Linux operating systems since those pre-van Smoorenburg rc days. (BSDs retain /etc/rc.conf.local . Some of them actually have a strict rule about not putting anything other than a map of name=value settings in there, though.) On Linux operating systems, the kernel's terminal emulator's configuration hasn't been done by explicitly writing a loadkeys command for almost as long. * /etc/default/keyboard has been the Debian mechanism since roughly the turn of the century, and one has to work out what XKBLAYOUT, XKBVARIANT, and XKBOPTIONS combination means "swap capslock and control". The Debian people designed it to do both the kernel's terminal emulator and X11 in one. So one probably uses XKBOPTIONS='ctrl:swapcaps' and ignores what you wrote about X11 entirely. (-: * The vanilla systemd mechanism is /etc/vconsole.conf , which doesn't have the internally complex Debian approach of trying to have the kernel terminal emulator and X11 configured in lockstep, and the variable to change is named KEYMAP . On FreeBSD/PC-BSD one just sets the keymap variable in /etc/rc.conf . Out of the box, FreeBSD/PC-BSD only comes with a few keymaps that swap capslock and control, and their names aren't regular. So one will have keymap="uk.iso-ctrl" but also keymap="bg.bds.ctrlcaps" . The nosh user-space terminal emulator uses FreeBSD/PC-BSD keymaps. But it supports overlaid keymaps. Using an overlay, the configuration import subsystem makes both a vanilla (.kbdmap) and a swap-capslock-and-control (.capsctrl.kbdmap) compiled keyboard map from each of the FreeBSD/PC-BSD keymap source files.
- groovy2shoes 10y agoThanks for the info! You're definitely right about rc.local -- I mostly mentioned it as sort of the "greatest common denominator" of boot-time config across Linux distributions. Systemd notwithstanding, every distribution has (had?) its own method of setting the vtty keymap. I didn't know that about Debian's config, though -- that's really neat, and imho how such config should be done (though I'm a Slacker myself). A couple of the more "BSD-ish" distributions do have an rc.conf.local (CRUX comes to mind, and iirc Arch had one in the pre-systemd days). Slackware, at least, still has an rc.local, and it's always the last step in multiuser boot (init 3, or just before the display manager is launched in init 4). Thanks for the FreeBSD info, as well. Unfortunately, my (admittedly ancient) HDD crashed in my FreeBSD box recently (relatedly, if you know where I can find some big-ass IDE/PATA HDDs, I'm on the market... seems like NewEgg doesn't even sell IDE drives anymore, and Amazon's selection is rather shit). nosh sounds really cool. How have I not heard of this before?! Anyway, thanks for the learning :)