Mac 'Home' and 'End' keys to behave like Windows

I am a Windows native. My fingers expect my keyboard to work in a Windows way. My big annoyance lately has been the End and Home keys. On Windows they move the cursor to the end or beginning of the line, respectively. On Mac they move the cursor to the end or beginning of the whole document, respectively. While this may be useful for someone who is accustomed to this behavior, I find myself trying to use them in a Windows way a lot more than not.

I have noticed, and find it funny, that Microsoft software on the Mac uses the keys in a Windows style. Of course it does.

I recently found how to change this behavior on the Mac to be like Windows. Thanks to damieng.org for this solution.

It is actually pretty simple, though creating this from scratch would be complicated. Just create a file ~/Library/KeyBindings/DefaultKeyBinding.dict with the below content.
{
  "\UF729"  = moveToBeginningOfParagraph:; // home
  "\UF72B"  = moveToEndOfParagraph:; // end
  "$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
  "$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
  "^\UF729" = moveToBeginningOfDocument:; // ctrl-home
  "^\UF72B" = moveToEndOfDocument:; // ctrl-end
  "^$\UF729" = moveToBeginningOfDocumentAndModifySelection:; // ctrl-shift-home
  "^$\UF72B" = moveToEndOfDocumentAndModifySelection:; // ctrl-shift-end
}

Restart your computer and you are golden!

Again, I am mostly putting this here to help me remember how I did this, but maybe it will help others.

If you want Windows style window snapping, check out the Magnet app by Kozarek and Sedlak in the Mac App Store. It costs $10 but in my experience it is worth it.

Comments

Popular Posts