Skip to content

Instantly share code, notes, and snippets.

@ricardodovalle
Created February 24, 2022 02:06
Show Gist options
  • Save ricardodovalle/7f3f77e0899df3e3cbc439dd4bab9548 to your computer and use it in GitHub Desktop.
Save ricardodovalle/7f3f77e0899df3e3cbc439dd4bab9548 to your computer and use it in GitHub Desktop.
mac: binding home/end keys
source:
https://medium.com/@elhayefrat/how-to-fix-the-home-and-end-buttons-for-an-external-keyboard-in-mac-4da773a0d3a2
https://www.maketecheasier.com/fix-home-end-button-for-external-keyboard-mac/
sudo bash
mkdir -p ~/Library/KeyBindings ; cd ~/Library/KeyBindings
vim DefaultKeyBinding.dict
{
/* Remap Home / End keys */
/* Home Button*/
"\UF729" = "moveToBeginningOfLine:";
/* End Button */
"\UF72B" = "moveToEndOfLine:";
/* Shift + Home Button */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* Shift + End Button */
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
/* Ctrl + Home Button */
"^\UF729" = "moveToBeginningOfDocument:";
/* Ctrl + End Button */
"^\UF72B" = "moveToEndOfDocument:";
/* Shift + Ctrl + Home Button */
"$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:";
/* Shift + Ctrl + End Button*/
"$^\UF72B" = "moveToEndOfDocumentAndModifySelection:";
}
Save (using the shortcut “Ctrl + o”) and exit (“Ctrl + x”) the file.
Restart your Mac. The “Home” and “End” should be working now, and you can use it in conjunction with the “Shift” and “Ctrl” modifier buttons.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment