Articles

Home/End keybindings

Here’s my custom keyboard bindings to make my external keyboard behave more sensibly like Windows, based off this guide and another guide I can’t find.

Put these into ~/Library/KeyBindings/DefaultKeyBinding.dict, creating the file if it doesn’t exist:

{
    /* home */
    "UF729"  = "moveToBeginningOfLine:";
    "$UF729" = "moveToBeginningOfLineAndModifySelection:";
    "^UF729"  = "moveToBeginningOfDocument:";                   /* Cmd  + Home  */  
    "^$UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Cmd  + Home */ 

    /* end */
    "UF72B"  = "moveToEndOfLine:";
    "$UF72B" = "moveToEndOfLineAndModifySelection:";
    "^UF72B"  = "moveToEndOfDocument:";                         /* Cmd  + End   */
    "^$UF72B" = "moveToEndOfDocumentAndModifySelection:";       /* Shift + Cmd  + End */

    /* page up/down */
    "UF72C"  = "pageUp:";
    "UF72D"  = "pageDown:";
}