Skip to content

Instantly share code, notes, and snippets.

@DerrikMilligan
Last active August 10, 2018 00:28
Show Gist options
  • Save DerrikMilligan/956b8daeceb27671abbfd0a38f794498 to your computer and use it in GitHub Desktop.
Save DerrikMilligan/956b8daeceb27671abbfd0a38f794498 to your computer and use it in GitHub Desktop.
Enable `home` and `end` keybindings on the MacOS

To have home and end keys funciton on a Mac as they do on a PC:

Create the file ~/Library/KeyBindings/DefaultKeyBinding.dict

This file will likely not exist and you may also need to create the KeyBindings directory.

In the file, insert this code.

{
  "\UF729"  = moveToBeginningOfLine:; // home
  "\UF72B"  = moveToEndOfLine:; // end
  "$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift-home
  "$\UF72B" = moveToEndOfLineAndModifySelection:; // shift-end
  "^\UF729" = moveToBeginningOfDocument:; // ctrl-home
  "^\UF72B" = moveToEndOfDocument:; // ctrl-end
  "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
  "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
}

You will have to close and open your applications for this change to take effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment