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:

  1. Open Terminal (Cmd + Space, type “Terminal”).
  2. Create the KeyBindings directory by pasting this command:
mkdir -p ~/Library/KeyBindings
  1. Create and open the configuration file:
nano ~/Library/KeyBindings/DefaultKeyBinding.dict
  1. Paste the following code into the window:
{
    "\UF729"  = "moveToBeginningOfLine:";
    "\UF72B"  = "moveToEndOfLine:";
    "$\UF729" = "moveToBeginningOfLineAndModifySelection:";
    "$\UF72B" = "moveToEndOfLineAndModifySelection:";
}
  1. Press Ctrl + X, then Y, and Enter to exit.
  2. 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.