If you use an external keyboard with Home and End keys on a Mac and have previously used a Windows computer, you might have noticed that these buttons don't work as you'd expect them to. Let's fix it.
Step-by-step guide
Open a Finder window.
Click the Go menu in the menu bar at the top of the screen.
Click Go To Folder.
Type ~/Library and click Ok.
- Look for a folder called KeyBindings.
- If it does not exist, create it.
- Create a file named DefaultKeyBindings.dict in the KeyBindings folder with the contents below.
- Reboot your computer.
DefaultKeyBindings.dict
{ "\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 can change the behavior of other keys as well!
References
- https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x
- https://developer.apple.com/documentation/appkit/nsstandardkeybindingresponding?language=objc
- https://ss64.com/osx/syntax-keybindings.html
Related articles