27 lines
1.0 KiB
Bash
27 lines
1.0 KiB
Bash
|
#!/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
|