Skip to content

Instantly share code, notes, and snippets.

@jasonwaters
Last active April 4, 2025 13:16
Show Gist options
  • Save jasonwaters/e458eb719f846455f6b9ad32e608c4d1 to your computer and use it in GitHub Desktop.
Save jasonwaters/e458eb719f846455f6b9ad32e608c4d1 to your computer and use it in GitHub Desktop.
Remap the home and end keys in macOS using Karabiner Elements
{
"rules": [
{
"description": "change home key to command + left_arrow",
"manipulators": [
{
"from": {
"key_code": "home"
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"left_command"
]
}
],
"type": "basic"
}
]
},
{
"description": "change home key to command + left_arrow while presing shift (selection)",
"manipulators": [
{
"from": {
"key_code": "home",
"modifiers": {
"mandatory": [
"left_shift"
]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"left_command",
"left_shift"
]
}
],
"type": "basic"
}
]
},
{
"description": "change end key to command + right_arrow",
"manipulators": [
{
"from": {
"key_code": "end"
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"left_command"
]
}
],
"type": "basic"
}
]
},
{
"description": "change end key to command + right_arrow while presing shift (selection)",
"manipulators": [
{
"from": {
"key_code": "end",
"modifiers": {
"mandatory": [
"left_shift"
]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"left_command",
"left_shift"
]
}
],
"type": "basic"
}
]
}
]
}
@jasonwaters
Copy link
Author

Update the rules section of ~/.config/karabiner/karabiner.json with the JSON array from this gist. Doing so remaps the home and end keys to work the way they work on pc/windows.

@ninovanhooff
Copy link

Also available here ( + more modifications): https://ke-complex-modifications.pqrs.org/

@Sojourner1066
Copy link

This does not seem to work in version 15.0

@damasceno-dev
Copy link

Here it is the updated version:

{
  "description": "Change home and end keys to command+arrow remappings (with shift for selection)",
  "manipulators": [
    {
      "type": "basic",
      "from": {
        "key_code": "home",
        "modifiers": {
          "optional": ["any"]
        }
      },
      "to": [
        {
          "key_code": "left_arrow",
          "modifiers": ["left_command"]
        }
      ]
    },
    {
      "type": "basic",
      "from": {
        "key_code": "home",
        "modifiers": {
          "mandatory": ["left_shift"],
          "optional": ["any"]
        }
      },
      "to": [
        {
          "key_code": "left_arrow",
          "modifiers": ["left_command", "left_shift"]
        }
      ]
    },
    {
      "type": "basic",
      "from": {
        "key_code": "end",
        "modifiers": {
          "optional": ["any"]
        }
      },
      "to": [
        {
          "key_code": "right_arrow",
          "modifiers": ["left_command"]
        }
      ]
    },
    {
      "type": "basic",
      "from": {
        "key_code": "end",
        "modifiers": {
          "mandatory": ["left_shift"],
          "optional": ["any"]
        }
      },
      "to": [
        {
          "key_code": "right_arrow",
          "modifiers": ["left_command", "left_shift"]
        }
      ]
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment