Back to Mobile View

Skip to Content

Remapping Key Combinations

Some people may think I am pro-*nix, but actually I really just like getting information out there for all our readers. Today I came across a great tip on Switch about Windows-like key bindings. If you don't dig the way Apple has the start and end key combos mapped in OS X, you can change them by creating the file ~/Library/KeyBindings/DefaultKeyBinding.dict with the following contents:

/* ~/Library/KeyBindings/DefaultKeyBinding.dict - Home/End keys more like Windows */
{
"\UF729" = "moveToBeginningOfLine:"; /* home */
"\UF72B" = "moveToEndOfLine:"; /* end */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* shift home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* shift end */
"^\UF729" = "moveToBeginningOfDocument:"; /* control home */
"^\UF72B" = "moveToEndOfDocument:";/* control end */
}


I personally tested this key binding hack in 10.4.4 and it does work. To test it be sure to quit out of your text application first. Also note that you will have to create a KeyBindings/ directory in your ~/Library/ because it is not there by default. To reverse the key bindings back to normal, just delete the DefaultKeyBinding.dict file you created and restart your text application. If there is a simpler GUI way to create these modifications please post about it in the comments for our readers.

If on the other hand you live in Terminal like me, the start of line and end of line key bindings are Control-A and Control-E respectively. This should feel comfortable to people accustomed to the normal Emacs mode in a shell in other *nix based operating systems.

[via Switch and comments on Ask Slashdot]

© 2014 AOL Inc. All Rights Reserved.