Skip to content

Instantly share code, notes, and snippets.

@kongchen
Last active August 29, 2015 14:10
Show Gist options
  • Save kongchen/717d712c26637145a751 to your computer and use it in GitHub Desktop.
Save kongchen/717d712c26637145a751 to your computer and use it in GitHub Desktop.
Fix Home and End key in Mac

To get your Home and End keys working properly on Mac OS X (Tiger and up, including Mavericks), simply open the Terminal and do this:

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

Put these lines in that file, including the curly braces:

{
/* 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 */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment