Making Home and End Buttons Work Correctly on a Mac
For the most part, using a Mac has been pretty easy after many years of using Windows. One of the really annoying changes though was the way the Home and End keyboard keys work. On a Mac they go to the start and end of the file rather than the line. If you’re like me, this seems really silly. To change it, do the following:
- Open Terminal (Cmd + Space, type “Terminal”).
- Create the KeyBindings directory by pasting this command:
mkdir -p ~/Library/KeyBindings
- Create and open the configuration file:
nano ~/Library/KeyBindings/DefaultKeyBinding.dict
- Paste the following code into the window:
{
"\UF729" = "moveToBeginningOfLine:";
"\UF72B" = "moveToEndOfLine:";
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
}
- Press Ctrl + X, then Y, and Enter to exit.
- Restart your Mac (or log out and back in) for the changes to take effect.
Note: The lines starting with
$handle Shift + Home/End, allowing you to highlight the line just like on Windows.
Read other posts