Skip to content

Instantly share code, notes, and snippets.

@thiagosf
Created January 28, 2018 18:21
Show Gist options
  • Save thiagosf/ec43382dc2ca720a3601efc9b8c2362f to your computer and use it in GitHub Desktop.
Save thiagosf/ec43382dc2ca720a3601efc9b8c2362f to your computer and use it in GitHub Desktop.
How to fix home and end keys on Mac OS X

How to fix home and end keys on Mac OS X

Open a terminal:

$ cd ~/Library
$ mkdir KeyBindings
$ cd KeyBindings
$ vi DefaultKeyBinding.dict

Copy/paste the following lines:

{
  /* Remap Home / End keys to be correct */
  "\UF729" = "moveToBeginningOfLine:"; /* Home */
  "\UF72B" = "moveToEndOfLine:"; /* End */
  "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
  "$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
  "^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + Home */
  "^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */
  "$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + Home */
  "$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Ctrl + End */
}

Save the file and restart your computer.

Enjoy your home and end keys!

Credits: https://www.jvandemo.com/how-to-fix-home-and-end-keys-on-mac-os-x/

@hungify2022
Copy link

It's saved my day ❤️

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