Because I dislike having to move my fingers far from the homerow, I created
a custom keyboard layout.
My goal was not to achieve a faster typing speed, but reducing the distance my fingers had to move from the homerow. Everything should be at the homerow ±1.
Keep in mind, that the alphabetic characters and even numbers stay right where they are on the standard US layout. Nothing is changed there, making the switch easier. This also means, that it doesn't interfere with any alternative keyboard layouts like Dvorak, Colemak or Workman, much. It should be easy to adapt it to those.
Sanitising the physical keyboard layout
I like the wide shift key of the US layout. But the US International and German layouts (as well as others) introduce another key right right of the left shift key. Hitting the left shift key is therefore not just moving the pinky down, but also moving it to the left. Not comfortable at all. Making this key my actual shift key is #1 on my list.
Likewise the return key on the German layout may be taller, but is still farther away from the homerow than on the US or US International layout. So on German keyboards I immediately map the #/' key to return.
Remapping special keys
EscapeBecause I'm an avid Vim user and the escape key is on another planet entirely, I map it to the capslock key. Members of the Church of Emacs might prefer to map control there.
Return & BackspaceAs you will see later, I don't need the left and right bracket keys anymore, so I decided to map the return key (as it is such an important key and still 2 keys away!) to, what used to be, the left bracket key.
Lastly I map backspace to the right bracket key. For me that's close enough that I can reach it without having to move my hand. While it is still further away than my target of homerow ±1, it's a key tahtitsn' nedeed ina prefect wrld anhywa.
Right ShiftI considered mapping the right shift key to the former return key, as it is the last key that is awkwardly to hit. Moving the poor pinky not only down or to the right, but diagonally. This feels very uncomfortable to me. A major downside of this is, that as soon as this becomes muscle memory, I'll hit enter all the time on regular keyboard layouts. And this can be really dangerous on the command line, or, basically everywhere.
Moving to a new layerNow that everything is at the homerow ±1 except for the digits and all the symbols, it's time to take care of those keys. Since I grew up with the German keyboard layout I was always used to the idea of using AltGr (the right Alt key) in combination with some other key for some symbols. So why not introduce a new layer to the US layout with all the symbols a programmer could ever need?
Note: On a Mac's keyboard the right Cmd and Alt key are swapped, so those two keys need to be remapped to make the right alt key easier to hit.
SymbolsThere are 3*10 keys at the homerow, up and down. Enough space to map all the symbols right there. This means: not having to stretch my fingers as far as the row of digits and in addition to that, not having to use my weakest finger, the pinky, to press shift, but use the strongest one, the thumb, to press AltGr. In addition to the symbols, the most used digits (at least in my code) are also included.
I tried to arrange them logically instead of based on some metric like same-finger or what-have-you ratio.
e.g. o = 0, i = 1, / = \
Opening and closing braces are right next to each other and under the strongest fingers.
+ and = directly on the homerow, while the considerably less used - is off the homerow, etc.
^ is to the left, as it marks the beginning of a line in a regular expression, while $ is to the right, because it marks the end of a line.
And . becomes -> because it's used to access members in C++ like . just for pointers. It's also the same finger as *, which is used to dereference pointers. Those things made it easy for me to learn and remember this layout.
Having _ off the homerow was okay when I created the layout, but since
then I've moved from CamelCase to using _ in variable names, so I'm not
really happy with where it is now. I consider swapping it with *.
But that's why the layout is called 2013.02. I don't rule out making minor changes over time.
Going digitalWith the symbols taken care of, it was time to find new keys for the digits. Since the AltGr layer was already full, I moved them to Shift+AltGr.
The arrangement might look odd, but its actually based on the numbers (not just digits) found in my code and the 3rd party libs I use.
The most frequent single-digit numbers (0, 1, 2, 8) are already covered on the first layer, so I tried to make the multi-digit numbers as easy to type as possible. Not surprisingly those numbers were 32, 255, 64 and 16. All those combinations are easy to type by simply rolling your hand from left to right, with the most common combinations on the homerow and the other two on the row above. 0 is used on its own most of the time and already covered on the first layer. 7, for some reason, is barely used at all so I moved it to the least desirable location. 9 is also barely used. And 8, well, I had to stuff it somewhere. I also added a decimal separator to conveniently type decimal numbers.
Yes, this arrangement takes some time getting used to when typing regular numbers. But typing those aforementioned most used combinations slips into muscle memory rather quickly.
The AltGr+Shift layer with its numbers is a rather new addition and for typing regular numbers I still fall back to the row with the digits quite often. I guess I would have to remove the original digits to force me getting used to their new placement. But I won't do that, because a lot of applications use combinations of modifier keys with a digit as hotkey and without the original digit-keys those hotkeys would be unavailable.
ConclusionI've been using this layout (and its previous iterations) for the last 6 years and it's only when I'm forcefully put in front of regular layouts, strapped down while screaming and shouting, that I realize how much more comfortable this setup is.
WindowsKeyboard layout: mld1302.zip.
Use SharpKeys with the following settings to remap the special keys:
OS XSave the keyboard layout mld201302.keylayout to ~/Library/Keyboard Layouts.
Configure PCKeyboardHack as follows:
And use this configuration (private.xml) for KeyRemap4MacBook. Enable: Wide Left Shift, Left Bracket as Return and Right Bracket as Backspace.
X11Add this to your ~/.XCompose file:
<U30000> : "->"If this file doesn't exist yet, add
include "%L"at its beginning.
Save this layout file to your X11 keyboard layout directory and activate it with
setxkbmap -layout mld -variant 105