:mhfs

Windows like Home and End keys on the Mac

When I bought an external keyboard to use with my macbook, I had 2 expectations. Stop burning my fingers in the freaking hot aluminum (I live in a hot city) and have Home/End/Delete keys.

My fingers were fine but the Home/End keys didn’t work as I expected. I wanted the same behavior I used to have in Windows, moving the cursor to the begin/end of each line.

After some research I discovered a small trick to achieve that. You can create a file named DefaultKeyBinding.dict under ~/Library/KeyBindings/ with the following content:

  {
      "\UF729"  = "moveToBeginningOfLine:";
      "$\UF729" = "moveToBeginningOfLineAndModifySelection:";
      "\UF72B"  = "moveToEndOfLine:";
      "$\UF72B" = "moveToEndOfLineAndModifySelection:";
  }  

Restart the application and you should be fine.

Cheers!

Fork me on GitHub