Mac OSX fixing home & end keys

This article is courtesy of the extremely intelligent Adam Fisher. Thanks Fisher!

If anyone wants the home and end keys on the macs to work in a more standard way like windows (put the cursor to the end or beginning of the current line), this quick process will fix them nicely in many programs (including TextMate).

Look in /Library for a folder called KeyBindings – create it if it doesn’t exist. Inside this folder, create a file called DefaultKeyBindings.dict that contains the following:

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

Leave a comment

Your email address will not be published. Required fields are marked *