Skip to content

Instantly share code, notes, and snippets.

@ambakshi
Created February 20, 2018 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ambakshi/2b00e957afaa346f099c57a7ec3bb948 to your computer and use it in GitHub Desktop.
Save ambakshi/2b00e957afaa346f099c57a7ec3bb948 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment