ambakshi
2/20/2018 - 1:51 PM

Fixes the osx home/end keys so they work the way they do on Linux/Windows.

Fixes the osx home/end keys so they work the way they do on Linux/Windows.

#!/bin/sh

mkdir -p ~/Library/KeyBindings
cd ~/Library/KeyBindings
if test -e DefaultKeyBinding.dict; then
  echo >&2 "WARNING: Skipping customizing key bindings. $(pwd)/DefaultKeyBinding.dict already exists"
  exit 0
fi
cat > DefaultKeyBinding.dict <<'EOF'
{
    "\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
}
EOF