Skip to content

Instantly share code, notes, and snippets.

@mathisto
Created December 3, 2019 16:46
Show Gist options
  • Save mathisto/daf6af351874b1c17d803c8ae3224bfe to your computer and use it in GitHub Desktop.
Save mathisto/daf6af351874b1c17d803c8ae3224bfe to your computer and use it in GitHub Desktop.
Windows style Home/End/Movements

I wanted my Home and End keys to behave as they do in Windows. I found a nice solution here and thought I would update with the recomended changes for modern OS versions.

  1. If not present, create directory ~/Library/KeyBindings.
  2. Create file ~/Library/KeyBindings/DefaultKeyBinding.dict
3. Paste the following contents:
{
  "\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
  ”^\UF702” = (moveWordLeft:); // ctrl-left 
  “^$\UF702” = (moveWordLeftAndModifySelection:); // ctrl-shift-left 
  “^\UF703” = (moveWordRight:); // ctrl-right 
  “^$\UF703” = (moveWordRightAndModifySelection:); // ctrl-shift-right
}
  1. Run killall Finder to implement changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment