ear-fung.us I’m a programmer. I’m also pro-grammar.

9Mar/060

Home and End Key Bindings in OS X

Anyone who knows me knows that I'm a die-hard OS X fan. I love the way it works, I love the way it feels, and I especially like the modular design of the OS.

One thing that bothers me though: when in text documents: hit the 'end' key. It goes to the end of the document. To me, that's pretty ridiculous. Same thing with the 'home' key.

So I did something about it.

Create a new file in '~/Library/KeyBindings' called 'DefaultKeyBinding.dict'
(if the 'KeyBindings' folder doesn't exist simply create it).

Put this in the file:

/* ~/Library/KeyBindings/DefaultKeyBinding.dict */
/* Changes home/end keys to a Windoze like behaviour */
{
"\UF729" = "moveToBeginningOfLine:"; /* home */
"\UF72B" = "moveToEndOfLine:"; /* end */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* shift + home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* shift + end */
}

Restart you application and the home and end keys will work like normal.

NOTE: This only works with Cocoa applications. All others will use their program specific key bindings.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.