Tuesday, February 5, 2008

Windows Home/End keys on your Apple Mac.

I recently switched from an IBM compatible PC running MS Windows to an Apple Macintosh running OS X Leopard. Up untill now I am very pleased with the system. It's fast, it's beautiful, OS X 'feels' good and somewhat more intuitive than MS Windows. There are however a few things that keep bugging me. Most of them I'll adapt to but never will I adapt to the ridiculous usage of the Home and End keys.

On OS X the Home key takes you to the start of a document and the End key takes you to the end. On MS Windows it takes you to the beginning of the line and the end of the line. I don't care where the OS X behaviour comes from, in my opinion, the latter is how it should be, period. You cannot discuss this with me. (Please do not try to start a discussion in a comment. If you like the OS X behaviour better, good on ya!)

So how can we change this? (for quite a few applications - not all applications react to the following change)

- Using the Finder or Terminal, go to your home directory. This is in /Users/.
- Locate your /Library folder.
- Look for a folder called /KeyBindings. If it's not there, create it.
- Inside this folder should be a file called DefaultKeyBindings.dict. If it's not there, create one with a text editor, I used TextEdit which worked. I don't know how other text editors perform.
- Add the following lines to this files content (If there is text like this one already present, omit the "{" and "}" characters):
/* home */
"\UF729" = "moveToBeginningOfLine:";
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";

/* end */
"\UF72B" = "moveToEndOfLine:";
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
- Save the file. Changes are in effect immediately for most NEWLY launched applications.


NB: This fix was taken from the following websites:
- http://blog.macromates.com/2005/key-bindings-for-switchers/


Kees said...

More handy Keyboard shortcuts
BTW, Begin-of-line is CTRL-LeftArrow, EOL=CTRL-RightArrow...

Vincent said...

@ Kees: Thanks for that link, always handy. On my mac it's Command + arrows. A bit clumsy. Control+arrows is used to change virtual desktop...