Escape Meta Alt Control Shift
December 6th, 2009For the last 4 years, I’ve been a vim user. My vim config is hundreds of lines long, my plugin folder is overflowing. For the last year, I’ve been using wmii as my window manager (before that, awesome), its config is similarly a work of art. I’m using my own keyboard layout, with some additional tools to complement it.
This week, all this changed. At first, I changed my monitor setup, but by doing so I had to modify my window manager and long story short, I’m now using Xmonad and I had a big fight, my last one, with vim and I’m now an emacs user, too. But emacs was the straw that broke the camel’s back, so to speak – I have a meta key problem.
I have way to many of them. I have my normal ASCIIbet, then Shift for capitals, Mod3 for punctuation or programming characters, Mod4 for functions like cursor keys or Return, then Control and Alt for emacs, the Windoze key for my window manager and a special key for my IME. It’s too much! It has now become very cumbersome to type certain things and I have to fix this mess.
Design Principles
- Hands should move as little as possible and never leave home row. This is a pretty basic requirement, but it prevents me from moving some rarer combinations to the outside of the keyboard.
- I must not give up any functionality. Specificially, I must still be able to type in (among others) French, German and Japanese, be able to programm efficiently and have enough keys left to handle Xmonad.
- The computer should do as much work for me as possible. If I can let it figure out what I meant and safe a few keystrokes in the average case, I will do it.
Solutions
First, I use my IME more aggressively than before. I’m currently using scim (with anthy and tables) to input any normal text beyond ASCII. This is pretty normal for Japanese, were you type 黒い猫 (kuroi neko, black cat) by activating Japanese mode, then inputting “kuroineko<SPACE>” and the IME converts this first into syllables (くろいねこ, ku ro i ne ko) and then tries to guess the correct meaning. I have already started using this for German a while ago and now use it for all diacritics. For example, I switch to European mode and then input “Verschw”orung” to get “Verschwörung” (conspiracy). This works pretty well because all diacritics are rare anyway and justify the additional key stroke. Each language (family) has its own mode to keep them simple and because I almost never mix them anyway.
This frees up some keys, and thus, my old basic layout:
(A few keys are redundant because they started out in a bad position, then moved to a better one and I saw no need to leave the old one empty. As you can see, the Mod3 level has still quite some open positions.)
I can’t move the punctuation characters inside my IME, because I generally mix them with normal text (typing something like “$editor =~ s/vi[m]/emacs/g”) and the IME would slow this down a lot. Inputting something like “\s” for “$” isn’t that cool and breaks many hotkeys. But, as you can see, Mod3 is used twice and in 2 really good positions, forcing me to put at least some meta keys in the outer corners at the bottom, which sucks.
So instead I decided to group them tighter together and move all characters to the right. This way I only need one Mod3 key. The Mod4 key, formerly right of Space, moves to the right of Left Shift. I can still press it with my left pinky and use the keys on the left. This frees more keys and leads to the following layout:
This might be a little confusing because I used some lazy abbreviations. The Mod4 level on the left has Backspace, Up, Down, Escape at the top, then Left, Down, Right, Insert and finally, at the bottom, Page Up, Page Down, Return, Tab. On the left are the meta keys Mod3, Mod4 and Win. On the right are Control, Meta and the 漢字 key to activate my IME. All the other keys on the keyboard are unchanged, but I can’t reach them anyway, so I don’t use them (except for numbers).
This arrangement isn’t optimal in the sense that some combos have to be typed by one hand, like ^ as M3 + i, and not all good keys are fully exploited (the left home row is under-used), but this is the best compromise in my opinion. All punctuation on the left side is rare and all frequent ones (and combination, like :) or !=) are easy to reach.
I was also experimenting with separating opening and closing parentheses because emacs (or any other editor) can easily match those anyway, but this doesn’t really improve the setup and makes it a lot more illogical and harder to learn. If it were not for programming, I would actually switch to a pseudo-latin input were similar characters would be merged and the IME would tell them apart, e.g. I would put i, j and y on the same key “i” and let the IME decide which to use. This works all pretty well for normal text, but in virtually any programming language, most letters are used frequently and, as a group, more often than punctuation. Having different layouts for different contexts, however, only makes a big mess.
(You might have wondered why I chose this particular key arrangement. It was originally Neo, a (now broken, see my old rant) German layout. I moved the J, X and Y, and removed all those silly additional levels and German characters, though. If I had to start over, I’d choose something like Dvorak as a base.)

