macOS: Fix the “Home” and “End” keys on a PC keyboard

On a full-size keyboard with dedicated “Home” and “End” keys, macOS doesn’t make them behave the way we’re used to.

I tried a bunch of remapping apps to get Windows-style behavior, but the simplest fix is to run a few commands in Terminal.

So, open Terminal and run the following commands:

$ cd ~/Library
$ mkdir KeyBindings
$ cd KeyBindings
$ nano DefaultKeyBinding.dict

The last command opened the nano console text editor. Now paste in the following code:

{
    /* Remap Home / End keys to be correct */
    "\UF729" = "moveToBeginningOfLine:"; /* Home */
    "\UF72B" = "moveToEndOfLine:"; /* End */
    "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
    "$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
    "^\UF729" = "moveToBeginningOfDocument:"; /* Ctrl + Home */
    "^\UF72B" = "moveToEndOfDocument:"; /* Ctrl + End */
    "$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; /* Shift + Ctrl + Home */
    "$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; /* Shift + Ctrl + End */
}
  1. Press Control+X to exit the editor, then press “y” to save the changes.
  2. Now, unfortunately, you’ll need to reboot.
  3. And just like that, your world is back to normal 🙂

Grabbed this from:

http://krustnic.github.io/posts/mac-os-home-end-keyboard-buttons.html
Прокрутить вверх