
Use caps lock as a language switch - marinintim
http://marinin.xyz/thoughts/capslock/
======
deathanatos
Some OSes (I know at least Linux does) support what's called "two-shift caps
lock": if you hit both shifts, together, you get caps-locks. If you hit only
one (on either side), you get a normal shift key.

This frees up the CapsLock-the-key for whatever you want, _and_ you get to
keep CapsLock-the-function. (And, you don't have to "move" it, such as in the
"Swap CapsLock and Control" schemes: you get to have normal Control, CapsLock
key for whatever you want, _and_ the capslock functionality.)

I mapped my CapsLock key to "Level3 shift" at home, and mapped various
interesting characters into the homerow, and space. I figured "_" is a word
separator, and space bar is for separating words, so Level3+Space = "_".
Level3 + the home row is stuff like ()[]{}; things that are normally way out.

Not sure how good the layout is, since I'm still trying to get used to it, and
old habits die _really_ hard. I was heavily inspired by the Neo keyboard
layout[1].

[1]: [http://neo-layout.org/index_en.html](http://neo-
layout.org/index_en.html)

~~~
henriquemaia
Thanks for your reply. After reading it, I went out searching on how to enable
"two-shift caps lock", because I sometimes need the caps lock (in Brazil
almost all government related documents demand caps for items such as your
name, etc.), but I also need a good compose key. I've been long using the caps
lock key as the compose key, but the lack of an alternative caps lock did
annoy me at times. Thanks to you, now I have the solution that perfectly fits
my personal needs!

------
MrRadar
Am I the only one who actually uses caps-lock for its intended purpose on a
regular basis? I use it pretty much any time I have to type more than two
capital letters in a row, which is frequently when I'm programming.

~~~
marinintim
Do you program in SQL? (I've just pressed Shift and released it after I typed
SQL, hey)

Using Caps Lock for its intended purpose means that it's another mode that you
need mental resources to keep track of.

Historical aside that's not related to your comment: early Soviet computers
modeled after IBM PC had Latin key, that basically worked like Shift, but it
changed layout from Cyrillic to Latin and vice versa. This idea died after MS
Windows, that didn't (and still doesn't? I don't know) have this option, took
over the market.

~~~
jimmaswell
Has anybody seriously been mentally bogged down by confusion from keeping in
mind that they have caps lock on? That sounds entirely implausible.

------
DigitalJack
On windows, I have capslock mapped thusly:

If pressed and released without another keypress in between, it sends ESC.

If pressed in combination with another key, it's CTRL.

I haven't found a way to do this dual mapping on OSX, so it's just CTRL there.
I use AutoHotKey for this on windows.

~~~
rjgray
I don't have my Mac in front of me, but you can do this using Seil[1] and
Karabiner[2]. From recollection, you disable caps-link in OS X settings, use
Seil to map caps-lock to control, and then use Karabiner to map tapped-ctrl to
escape. Sounds a bit hackish, but it works very well.

You can also do the same thing on Linux using xcape[3]

[1]:
[https://pqrs.org/osx/karabiner/seil.html.en](https://pqrs.org/osx/karabiner/seil.html.en)
[2]:
[https://pqrs.org/osx/karabiner/index.html.en](https://pqrs.org/osx/karabiner/index.html.en)
[3]: [https://github.com/alols/xcape](https://github.com/alols/xcape)

------
qwertyuiop924
This is problematic for Emacs users: You can't put Switch Lang there, you need
Control there!

However, you could bind this to lcontrol, and get the capslock light to turn
on when it goes.

Also, am I the only one who at some point rebound ralt to rshift? I've stopped
doing it now. I don't know what I was thinking.

~~~
marinintim
Language switch is problematic for Emacs users in general, 'cause it messes
with bindings.

So when I do emacs I use mule, which is mapped by default as C-/. It is not so
bad if you remap Caps to Control, but still not one key.

~~~
qwertyuiop924
Well, the idea is that you're using emacs for your code, and then you jump
over to your mail client (all the emacs mail clients don't really work for
me), and hit a key to switch over to russian, or whatever.

------
tyleo
I am a Vim user. Mapping Caps Lock to Esc has been pretty valuable and it only
took me about a week to get used to the change.

~~~
elg0nz
Have you tried the jk chord? for me, it feels faster because the j key is
where my right index finger parks.

:inoremap jk <esc>
[http://learnvimscriptthehardway.stevelosh.com/chapters/10.ht...](http://learnvimscriptthehardway.stevelosh.com/chapters/10.html)

~~~
Dylan16807
Oh, you mean hitting j and k in sequence, not an actual chord.

Is there a way to make it trigger when pressing both keys at the same time?
I'd rather not have a letter sequence that can kick me out of insert mode,
especially when I'm pasting into my terminal.

~~~
Zathrus1
No; there's absolutely no way for vim (terminal vim at least, but gvim
inherits lots of terminal quirks) to see a chord like that.

But, never fear -- if you paste while in paste mode (:h 'paste or :h
'pastetoggle) imaps, iabbrs, etc. do not get activated. If you paste when not
in paste mode then things tend to get messed up anyway and those are probably
the least of your worries.

Or paste using the clipboard -- "+p in normal mode, or <c-r>\+ in insert mode.
(The other clipboard is in the asterisk register, but HN keeps eating the
character)

------
hs86
I mapped caps lock to ctrl on Windows and to command on MacOS. Using the
system wide default shortcuts feels much easier this way, because caps lock is
on the same middle row where my fingers usually rest.

I got this idea from the custom layout of the HHKB keyboard:
[https://elitekeyboards.com/proddata/doc/hhkbp2_basic_layout1...](https://elitekeyboards.com/proddata/doc/hhkbp2_basic_layout1500.png)

~~~
eridal
This is a great tip for chromebooks users, as these machine dont have such
key!

------
Kenji
Speaking of multilinguals - note that Swiss people actually _need_ capslock to
type things like 'Ö' because if you press SHIFT + 'ö' then you get 'é' on a
Swiss layout (well, I guess you could type '¨' first and then 'O', that also
assembles to 'Ö'). Gotta accomodate for both German and French. Just a bit of
trivia you might not have known.

~~~
mxfh
Try the US-International Layout on US-QWERTY. It works well with German and
French as secondary languages.

[https://en.wikipedia.org/wiki/QWERTY#US-
International](https://en.wikipedia.org/wiki/QWERTY#US-International)

The Windows version makes more sense to me, but I'm getting used to the Mac
one too.

~~~
ucs
Indeed. On my bog standard US+International layout I can simply do:

AltGr + e = é

AltGr + p = ö

Adding Shift to the mix produces É and Ö, respectively, as one would expect.

------
ucs
I use Caps Lock as an extra general-purpose function key (F20), which I can
then bind as I please depending on the application.

Mapping it as an extra modifier seems a tad unergonomic. Ideally, each
modifier key should be located on either side of the keyboard, so that you can
always engage it with the opposite hand. To that end, I also remap the Menu
key on my MS Natural Keyboard[1] to act as a second Super modifier.

Furthermore, since I'm multilingual and need an AltGr modifier on both sides
as well, I map the combo Ctrl+Super to act as AltGr. See my US+International
XKB keymap[2] should you happen to want a similar setup on Linux.

[1] [https://www.microsoft.com/accessories/en-
us/products/keyboar...](https://www.microsoft.com/accessories/en-
us/products/keyboards/natural-ergonomic-keyboard-4000/b2m-00012)

[2]
[https://gist.github.com/ucs1/fe673a3606442911dbd7d016a372646...](https://gist.github.com/ucs1/fe673a3606442911dbd7d016a3726465)

------
ramblenode
I love Caps Lock. It's just a free key on the home row to reprogram to
whatever you want. I change mine to ESC for easier Vim interaction.

------
heinrich5991
The caps key is clearly destined for the compose key, quite useful if you
sometimes need to type different languages. "şçäë"

------
pdkl95
Caps_Lock should be mapped to Control_L so you can type it in the home row
with less stress to the hand/fingers. (no twisting)

Additionally, one of the better changes I made years ago was mapping
redundant/useless modifiers to the bucky bits[1] in my ~/.Xmodmap.

    
    
        Phys Key | New Modifier Mapping
        -----------------------------------
        CapsLock | Control
        Alt_L    | Meta
        Alt_R    | Alt   (mod4)
        Win_L    | Super (mod3)
        Win_R    | Hyper (mod5)
    

To my surprise, quite a few programs support the higher modifier bits.

[1] [http://www.catb.org/jargon/html/B/bucky-
bits.html](http://www.catb.org/jargon/html/B/bucky-bits.html)

~~~
AnonymousPlanet
Or you could use the edge of your left palm to hit CTRL. This reduces strain
and is much faster.

It's the way I could use Emacs to write my thesis and only wonder about those
stories of RSI. On Mac and Linux, I have CTRL-Number set to switch workspaces.

------
dogma1138
Under windows you don't need to use 3d party apps.

Regedit HKEY_CURRENT_USER\Control Panel\Input Method\Hot
Keys\Your_Language_IME

Set the key modifier to 00 and set the virtual key to the key you want caps
lock is 04 iirc. [https://msdn.microsoft.com/en-
us/library/windows/desktop/dd3...](https://msdn.microsoft.com/en-
us/library/windows/desktop/dd375731\(v=vs.85\).aspx)

I think there was also a way to hack it through HKEY_CURRENT_USER\Keyboard
Layout\Toggle but I'm not sure if it's used anymore.

------
neurocroc
I actually think you can take it a step further. I have my caps lock mapped to
esc on single press and as opt + control when held but I also use something I
call sticky keys that allow me to keep my hands on the keyboard and on the
home row at all times.

[Here it is and how I use
it.]([https://github.com/nikitavoloboev/dotfiles/tree/master/karab...](https://github.com/nikitavoloboev/dotfiles/tree/master/karabiner))

------
hprotagonist
CAPS_LOCK -> L_CONTROL.

Long-time emacs use has permanently changed my left pinkie.

------
trevyn
I used caps lock as backspace for a long time, I quite enjoyed it.

------
sssilver
As an "academic" touch typer, I use Caps Lock as intended (for typing more
than 2 all-caps letters in a row), however since I need that much less
frequently than Ctrl, I swap Ctrl and Caps Lock on every computer that I call
home. As far as switching between 3 keyboard layouts (dvp, Armenian, Russian),
I map that to Option+Command+Space, but now that I think about it there's
probably a better combination to be found.

------
grahamburger
I mapped caps lock to left click and then used eviacam to control the mouse
pointer with my face. No more keyboard<->mouse back and forth. Works great!

------
franciscop
Well this is just magic. I had set it up to Ctrl+Space since I speak Spanish,
English and learning Japanese. I am not fluent enough in Japanese yet, but it
becomes a burden when trying to write a website in Spanish.

You can just do this instead in Ubuntu: Text Entry Settings => click on
"Switch to the next source using" => Caps Lock

------
smilekzs
I've been doing this for a while. I agree it's the most natural map for a
multi-lingual ({en-US, zh-CN, ja-JP} here).

AutoHotkey on Windows 10:

    
    
        CapsLock::#Space
        +CapsLock::+#Space

------
lowmagnet
I hold caps lock for ctrl, and tap it for escape. Right then left shift is my
caps lock, tap shift to unlock.

------
rhinoceraptor
I don't even have a caps lock key programmed on my ErgoDox keyboard.

