Skip to content

Instantly share code, notes, and snippets.

@lukasszz
Created May 13, 2025 06:45
Show Gist options
  • Save lukasszz/7888672e92bacb129a900056fe836f84 to your computer and use it in GitHub Desktop.
Save lukasszz/7888672e92bacb129a900056fe836f84 to your computer and use it in GitHub Desktop.
{
"description": "MacOS Change Home/End keys to Command + Left/Right Arrow (start/end of line)",
"manipulators": [
{
"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"]
}
]
},
{
"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"]
}
]
}
]
}
@lukasszz
Copy link
Author

This configuration solves the common issue for Linux and Windows users who are accustomed to the Home and End keys moving the cursor to the beginning and end of the current line, respectively. On macOS, by default, these keys move the cursor to the start or end of the entire document, which can disrupt editing habits. The following Karabiner-Elements rule remaps Home and End to behave like on PC.

1.	Open Karabiner-Elements.
2.	Go to the “Complex Modifications” tab.
3.	Click “Add Rule”.

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