MacOS

Making the Magic Keyboard Home & End buttons behave like Windows.

When you started using the Magic Keyboard, your fingers are likely to fall into the habit of trying to use these Windows commands:

  • Home to go to beginning of the line (failed)
  • End to go to the end of the line (failed)
  • Ctrl + End to go to end of the document (failed)
    It’s going to the end of the document, not what I want.
  • Ctrl + Home to go to the start of the document (failed)
    It’s going to the end of the document, not what I want.
  • Shift + Ctrl + Home to select all to start of document (failed)

Some things did work — just not what you expect:

  • Ctrl + Left to go to the start of the line (worked)
  • Ctrl + Right to go to the end of the line (worked)

The solution

The only solution is to change my keyboard so I don’t have to change me.

  1. Open Terminal in MacOS
  2. Type the following commands, one per line:
cd ~/Library
mkdir KeyBindings
cd KeyBindings
nano DefaultKeyBinding.dict
The top part is what your Terminal should look like

3. Next, copy and paste the below key mapping into the editor that shows:

{
/* Remap Home / End keys */
/* Home Button*/
"\UF729" = "moveToBeginningOfLine:";
/* End Button */
"\UF72B" = "moveToEndOfLine:";
/* Shift + Home Button */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* Shift + End Button */
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
/* Ctrl + Home Button */
"^\UF729" = "moveToBeginningOfDocument:";
/* Ctrl + End Button */
"^\UF72B" = "moveToEndOfDocument:";
/* Shift + Ctrl + Home Button */
"$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:";
/* Shift + Ctrl + End Button*/
"$^\UF72B" = "moveToEndOfDocumentAndModifySelection:";
}
In the editor, paste the above key mappings

4. Then save the file by pressing Control ^ + o then Control ^ + x to exit.

5. Restart your Mac for the changes to take effect.

    Upload file