My perfect typing environment. Finally.

I built me a mechanical keyboard specialised for Emacs and coding

If you have read my earlier articles about my search for the perfect keyboard, you may have got an idea of what I was looking for. Namely a mechanical keyboard with a decent keyboard layout, optimized for my use case. I mostly do my writing with Emacs, and a lot of it is german text and programm code. In the meantime I found my perfect solution, and realized I had no article of it in my blog. So this is it, maybe it is of use for some of you.

The keyboard

My decision finally zeroed in on buying a conventional keyboard with MX-Switches, as they have that exact tactile feeling that is deeply satisfying while I type. They are a bit loud for an office environment with colleagues around, but as I only use the keyboard at home it is ok. I ordered it with some touch of my personal coloring taste, and a special keyboard layout, that I gave some thought beforehand.

The thoughts

Some of the thoughts I had, before I ordered the keyboard, were going into the use cases I have, and in the constraints that a normal keyboard is delivering to this use cases. Namely:

  • I type a lot of programming code

    The optimal keyboard layout for that would be most probably an american, because most programming languages were developed with an american keyboard in mind. Characters like [, { or | are easily reachable on those keyboards. Sadly

  • I write a lot of german text

    and that means I absolutely want to have Umlauts in my layout. The german layout has those keys to the right of the keyboard, where they rule out some of that keys that are crucial for programming on an american board. As a consequence the german layout makes heavy use of the AltGR key to shift into a layer in which those keys are reachable. Unfortunatly this key is normally pressed with the least sensible finger, the pinky. Which leads me to the next issue,

  • I write in Emacs

    The Emacs community has a concept that is called "Emacs pinky syndrome" and refers to he fact that Emacs makes heavy use of all your auxiliary keys like Shift, Ctrl or Alt. there is an often quoted saying, that Emacs is just an abbreviation for Escape-Meta-Alt-Ctrl-Shift. And for most of that keys you have to press some letters with your left pinky on one of that keys. Sometimes even more than one of it.

The layout

The gist of that matter was space. I needed the space for the german Umlauts, as well as those coding keys, that are to find in an american layout. Oh, and more Meta-keys would be of help for Emacs, to eliminate those long key combinations that are hard to memorize.

The solution got in reach, when I realized that I nearly never use the numbers in the numbers row at the top of the keyboard. Instead of there, I type them on the number pad to the right. And there it was: SPACE, THE FINAL FRONTIER! Ah, and nobody needs CapsLock either.

So I began to move all those keys that are only reachable via the AltGr key to the upper number row, leaving as much characters as possible in place that were already in the top row except numbers. All brackety chars ({[<>]}) are now on only 4 keys (7,8,9,0) which causes the only relocation that was needed. The = char had to move to the right to give way for the >, and so also the ? had to move and I chose to place it on the key where the 1 once was, so it is right below the !.

Following the same idea the ' was placed on the same key as the " so I have all quoting chars on one key, To use the normal chars used for quoting a string there is now no need for a Shift key anymore. That made place for the ~ which moved a key down, and can now be typed with just Shift instead of the pinky-heavy AltGr.

The only two keys left where now the | which I moved to the same key as the & (both are used in many programming languages as logical AND and OR). The now empty key on the lower left became home to the backslash, together with the normal slash as the un-shifted key. The @ sign found it's home at the place of the former 3 together with the Euro sign when shifted.

You can see the result in the following image:


To make Emacs a little bit easier to use I also made CapsLock the Super-key and the now unneeded AltGr became the Hyper-key. The Alt-key was named Meta (that would have been the correct name for it's function anyways).


Within two weeks I had fully memorized the positions of the moved keys, and I don't mix them up with the traditional layout I use at the office computer. This risk was, what held me back from using the NEO Layout, which is also optimized for Germans and programming use.

The Super and Hyper keys are great when using Emacs. I made me a still growing set of Hydras and mapped it to the Hyper key (Hyper/Hydra made it very easy to memorize). The Super key becomes more useful to call whole Emacs modes like mu4e, magit or calendar modes.

As a side effect I never get stuck in CapsLock anymore, so no more badly typed password three times in a row.

The feeling that "something is wrong" while I type had completely gone, and now it feels so naturally, that i'm far less distracted, and could finally better concentrate on the content.