| |
| [ Blog ] [ Open Source ] [ Programming ] | |
« Free Trial of Red Hat Enterprise Linux 4 | Main | equals and hashCode »
On Mac OS X, you can create a default key-binding file and override the default keymap of most Mac OS X applications. More information on this is available in the Apple Developer Connection article Text System Defaults and Key Bindings.
I saw this post on Slashdot, which has a nice example of creating an improved default keymap (improved for those of us recently switching from Windows). I took it and added control-home and control-end to better finish out the windows emulation behavior.
In order to use the new key-binding, here's what you need to do:
Create the directory $HOME/Library/KeyBindings
Save this as $HOME/Library/KeyBindings/DefaultKeyBinding.dict
/* ~/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 */
}
Once done, you can simply fire up TextEdit and try it out.
Posted by rcleveng at March 1, 2005 04:52 PM