Created
October 24, 2015 18:04
-
-
Save piotrkubisa/723d97b028804cb96c80 to your computer and use it in GitHub Desktop.
Set windows-like page-up, page-down, home, end key bindings globally on OS X like a sir (using just one script).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env | |
cd "$HOME/Library/" | |
mkdir -p "KeyBindings" | |
cd KeyBindings | |
file="DefaultKeyBinding.dict" | |
if [ -e $file ]; then | |
echo "Error: File already exists! In aware of conflicts please review insertion manually." | |
echo "Put the following rules in `pwd`/$file" | |
cat <<EOT | |
{ | |
/* home */ | |
"\\UF729" = "moveToBeginningOfLine:"; | |
"$\\UF729" = "moveToBeginningOfLineAndModifySelection:"; | |
/* end */ | |
"\\UF72B" = "moveToEndOfLine:"; | |
"$\\UF72B" = "moveToEndOfLineAndModifySelection:"; | |
/* page up/down */ | |
"\\UF72C" = "pageUp:"; | |
"\\UF72D" = "pageDown:"; | |
} | |
EOT | |
else | |
cat > $file <<EOT | |
{ | |
/* home */ | |
"\\UF729" = "moveToBeginningOfLine:"; | |
"$\\UF729" = "moveToBeginningOfLineAndModifySelection:"; | |
/* end */ | |
"\\UF72B" = "moveToEndOfLine:"; | |
"$\\UF72B" = "moveToEndOfLineAndModifySelection:"; | |
/* page up/down */ | |
"\\UF72C" = "pageUp:"; | |
"\\UF72D" = "pageDown:"; | |
} | |
EOT | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: https://www.starryhope.com/mac-os-x-home-and-end-keys/