2008-01-14

HowTo: PC-Style keyboard mapping on Mac OS X (german keyboard)

The keymap on a german keyboard attached to a Mac is rather different that what people expect from a standard Linux or Windows PC. This is very irritating for novices and geeks at the same time. Especially if you program a lot you miss the braces and the brackets, but most of all you miss the backslash, the pipe symbol, the tilde and the AT symbol. Apple! How dare you! The backslash on a german keyboard is Alt+Shift+7! Argh!

Anyway, these days are over. Here is how to get a pretty standard PC-Style keymap alongside the old Apple bindings if possible:

1. mkdir ~/Library/KeyBindings (if it does not exist)
2. put the following text into the file Library/KeyBindings/DefaultKeyBinding.dict
3. Log out and log in (some apps like TextEdit pick up the changes directly when you restart them)


{
"\UF729" = "moveToBeginningOfLine:"; /* pos1 */
"^\UF729" = "moveToBeginningOfDocument:"; /* crtl + pos1 */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
"\UF72b" = "moveToEndOfLine:"; /* end */
"^\UF72B" = "moveToEndOfDocument:"; /* ctrl + end */
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
"\UF72C" = "pageUp:";
"\UF72D" = "pageDown:";
"^~7" = ("insertText:", "|"); /* orig alt 7 */
"^~8" = ("insertText:", "{"); /* orig alt 8 */
"^~9" = ("insertText:", "}"); /* orig alt 9 */
"^\U00DF" = ("insertText:", "\U00BF");
"^+" = ("insertText:", "\U00B1");
"~<" = ("insertText:", "|");
"~7" = ("insertText:", "{");
"~0" = ("insertText:", "}");
"~8" = ("insertText:", "[");
"~9" = ("insertText:", "]");
"~+" = ("insertText:", "~");
"~\U00DF" = ("insertText:", "\U005C");
"~q" = ("insertText:", "@");
"^x" = "cut:";
"^c" = "copy:";
"^v" = "paste:";
}


This gives you the braces, the brackets, the backslash, the pipe symbol, the AT symbol, the tilde, Home/End on PC typical key combinations. It also gives Ctrl+X, C, V for cut/copy/paste in addition to Command+X, C, V. Most of the Apple key combinations still work after this change, so Mac users would still find their way in your system. The most noticeable change is Alt+7 for the pipe symbol which is now the opening brace.

I got all the info from this german page:

Tastaturbelegung unter Mac OS X

which provides a very useful example keymap (which I extended a bit above) and a link to this great page:

http://www.lsmason.com/articles/macosxkeybindings.html

The latter one provides virtually all the background information you need to do your own keymaps.

Happy keymapping!

1 Kommentar:

Placa de Vídeo hat gesagt…

Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Placa de Vídeo, I hope you enjoy. The address is http://placa-de-video.blogspot.com. A hug.