MacOS Proper Home and End Keys

March 21, 2017 by Jon Whitcraft

So recently I got a new MacBook Pro and while I didn't get everything setup the way I had it on my old MacBook, the one thing that was bothering me was the Home and End keys not working like they do on Windows. While this shouldn't be a deal breaker, I knew on my old MacBook I had it setup so the keys would goto the begning of the line or the end of the line, but I couldn't remember how it was done.

Finally today I stumbled across an old bookmark to stack overflow that had the setup in it.

I'm mainly just putting this here, so i'll remember where it's at, in the future, but i figured why not put the steps here

mkdir -p ~/Library/KeyBindings/

cat > ~/Library/KeyBindings/DefaultKeyBinding.dict <<- EOF
  "\UF729"  = moveToBeginningOfLine:;
  "\UF72B"  = moveToEndOfLine:;
  "$\UF729" = moveToBeginningOfLineAndModifySelection:;
  "$\UF72B" = moveToEndOfLineAndModifySelection:;

Now just restart most programs and you'll be able to use Home and End like you do on a Windows box.

© 2017-2019 h2ik | Build With Hugo