n8blog
distraction in action

Like my work? Check out HexaLex, my game for iPhone & iPod Touch. It's a crossword game like Scrabble, but played with hexagonal tiles. http://www.hexalex.com

Archive for May 7th, 2004 :

For some reason the Mac gods decided that Home and End scroll your window to the beginning and end of file respectively. This is just wrong. They should move the cursor to the beginning or end of the line it's on, just like they do in every other modern UI. Thankfully, there's a way to fix this for all Cocoa apps, which for me is everything I use!

First you need to make a subdirectory called KeyBindings in your ~/Library directory. Next, use your favorite text editor to create a file in that directory named DefaultKeyBinding.dict containing this text:

{
    "\UF729"  = "moveToBeginningOfLine:";                   /* Home */
    "\UF72B"  = "moveToEndOfLine:";                         /* End */
    "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift-Home */
    "$\UF72B" = "moveToEndOfLineAndModifySelection:";       /* Shift-End */
}

Restart any Cocoa apps (Safari, Mail, or TextEdit) to see the new keybindings take effect!

For more info on this method of binding keys see this OS X hint and this Apple document. The commands like moveToEndOfLine: are actually “Action methods” of the NSResponder Cocoa class.

  • Share/Bookmark

Like my work? Check out HexaLex, my game for iPhone & iPod Touch. It's a crossword game like Scrabble, but played with hexagonal tiles. http://www.hexalex.com