So, one of the things that drove me nuts about MacOS/OSX for years is Apple’s non-standard mapping of the home and end keyboard keys to start-of-document and end-of-document.
The non-standard key combinations CMD+→ and CMD+← are used to perform BOL and EOL instead.
Here’s the problem: That is not how it’s been done on other platforms that long pre-date MacOS/OSX or even the Mac itself. I typically switch between multiple operating systems every day, and consequently, coming back to MacOS/OSX fouled up my typing/editing every time. So I went looking for a solution. I found one in Karabiner.
However, Karabiner is decidedly user-unfriendly in that in order to add a key remapping, you have to either import someone else’s prewritten customization (and what you want to do may not be available), or actually hand-edit the JSON config file ~/.config/karabiner/karabiner.json
It’s not particularly obvious what to do either. There are no instructions. Anywhere. At least, not as I write this.
So here’s how to remap the OSX home and end keys using Karabiner so they work like they do on every other operating system. There are two steps:
Step One: Insert the green text below immediately after the white text you’ll find in your ~/.config/karabiner/karabiner.json file:
“parameters”: {
“basic.simultaneous_threshold_milliseconds”: 50,
“basic.to_delayed_action_delay_milliseconds”: 500,
“basic.to_if_alone_timeout_milliseconds”: 1000,
“basic.to_if_held_down_threshold_milliseconds”: 500,
“mouse_motion_to_scroll.speed”: 100
},
“rules”: [
{
"description": "home to BOL",
"manipulators": [
{
"from": {
"key_code": "home"
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"left_command"
]
}
],
“type”: “basic”
}
]
},
{
“description”: “end to EOL”,
“manipulators”: [
{
"from": {
"key_code": "end"
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"left_command"
]
}
],
“type”: “basic”
}
]
},
Step Two: If there were already additional customizations in the file that you inserted this above, add the red comma at the end of the newly inserted section; each entry except the last requires a trailing comma.
Indentation — how far from the left margin each line begins — doesn’t matter. It’s just used to make the information a bit more human-readable. Only white-space within double quotes (") is significant here.
#1 by Raj on April 26, 2020 - 7:30 pm
Quote
Tried this out but when I copy it into that file, save, and open up karabiner, it overwrites the copied text.
I just found a much easier solution though. If you click on import here for Home and End and Shift Home and End:
https://ke-complex-modifications.pqrs.org/
Then it’ll import into Karabiners with no apparent problems!
#2 by admin on April 26, 2020 - 7:34 pm
Quote
Glad you got it in there
After using it for months, I find I miss the entire document home and end somewhat, but still, having the line editing work properly is great.