1
1
Fork 0

Added a script to fix mapping of macos End and Home behaviour

This commit is contained in:
david 2023-12-12 12:00:31 +01:00
parent 0768dae8c6
commit 87703ecada
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
#!/bin/bash
# This just solved a huge problem for me, so i'm putting it in a little script for future use
# https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x/
FILE="$HOME/Library/KeyBindings/DefaultKeyBinding.dict"
if [[ -r "$FILE" ]]; then
echo "There is already a keybinding file at $FILE"
else
if ! [[ -d "$(dirname $FILE)" ]]; then
mkdir -p "$(dirname $FILE)"
fi
echo "Creating keybinding file at $FILE"
echo '{
"\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
}' > $FILE
echo "You have to reboot in order for the changes to take effect"
fi