July 28, 2020
Fixing home/end behaviour on macos
This is just a quick note for how to make Home
and End
keys behave sensibly, i.e. take you to the beginning or end of a line:
mkdir ~/Library/KeyBindings && touch ~/Library/KeyBindings/DefaultKeyBinding.dict
Then paste into DefaultKeyBinding.dict
the following content:
{
"\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
}
Some also like to remap ctrl-
keybindings:
"^\UF702" = (moveWordLeft:); // ctrl-left
"^$\UF702" = (moveWordLeftAndModifySelection:); // ctrl-shift-left
"^\UF703" = (moveWordRight:); // ctrl-right
"^$\UF703" = (moveWordRightAndModifySelection:); // ctrl-shift-right
You’ll need to restart MacOS for the change to take effect.
Sources: