Skip to content

Instantly share code, notes, and snippets.

@yorkxin
Created December 23, 2011 01:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorkxin/1512701 to your computer and use it in GitHub Desktop.
Save yorkxin/1512701 to your computer and use it in GitHub Desktop.
Mac OS X Function-Key Hack
{
/* home */
"\UF729" = "moveToBeginningOfLine:";
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* end */
"\UF72B" = "moveToEndOfLine:";
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
/* page up/down */
"\UF72C" = "pageUp:";
"\UF72D" = "pageDown:";
}

Writing the settings

Textmate's tutorial may help you.

You may want to look up in Apple's document for Function-Key Codes (see Constants > Function-Key Unicodes) and Cocoa Event Names (see Instance Methods).

Applying the settings

Put this file under ~/Library/KeyBindings/DefaultKeyBinding.dict and restart a Cocoa Application.

Known Issues

This hack makes Home and End key not working in the address bar of Firefox. (It's not a native Cocoa Application)

Other useful links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment