Skip to content

Instantly share code, notes, and snippets.

@akersten
Last active March 23, 2026 00:41
Show Gist options
  • Select an option

  • Save akersten/7eed19a7941f5087764d9c99cdc4e63c to your computer and use it in GitHub Desktop.

Select an option

Save akersten/7eed19a7941f5087764d9c99cdc4e63c to your computer and use it in GitHub Desktop.
Make OSX keyboard shortcuts less ridiculous

The default window navigation shortcuts and modifier keys are absurd. This will map them closer to what every other platform uses.

Necessary software:

Nice-to-haves:

What we'll accomplish:

  • Remap the fn key to command, since most apps use that as the "primary" modifier (a la Windows/Linux) and it being the corner key is the most ergonomic
  • Remap the control key to fn, since it's in the usual fn spot on the mbp keyboard
  • Leave option key alone but treat it as the Super key for various shortcuts
  • Remap the command key to control
  • Control+backspace, control+left, control+right (and shifted variants thereof) to move word-at-a-time instead of line-at-a-time (line at a time is still available on the "control" modifier, which makes more sense since it's less used, it should be on the less ergonomic modifier
  • Remap home + end to go to the beginning/end of the line instead of the beginning/end of the entire document. Seriously, who would ever want that. Shifted variants as well to select.
  • There will also be a bunch of rules we'll write to catch special cases where we need to shove some of these combos off to unused (F16-F20) keys due to idiosyncrocies of "the MBP keyboard inexplicably unmaps the command key to option" and "it's nearly impossible to disable the default window command+tab switcher on OSX."
  • Reasonable shortcuts for taking a screenshot and locking the screen
  • Good window management using the option key+arrows (a la Windows)

Karabiner setup

Add the following simple shortcuts:

image

(Note: these modifier keys are mapped to Right variants. This is due to... other rules being able to see specifically these keys and working around weird OSX remapping of the physical fn key)

Add all of these complex modifications (these are attached to the Gist):

image

Rewrites for OSX key binding dictionary

To get the command+arrow key word-selection setup to work properly, we have to make a modification here:

nano ~/Library/KeyBindings/DefaultKeyBinding.dict

add the following:

{
    "@$\UF702" = moveWordBackwardAndModifySelection:;   /* Cmd+Shift+Left → select word left */
    "@$\UF703" = moveWordForwardAndModifySelection:;    /* Cmd+Shift+Right → select word right */
    
    /* Home/End → beginning/end of line instead of document. */
    "\UF729" = moveToBeginningOfLine:;
    "\UF72B" = moveToEndOfLine:;
    "$\UF729" = moveToBeginningOfLineAndModifySelection:;
    "$\UF72B" = moveToEndOfLineAndModifySelection:;
}

Unfortunately, I haven't figured out a way to get perfect behavior around this (shift+command+arrow still selects to front/end of line in non-Cocoa input fields) but this is better than nothing.

AltTab setup

We have to use the special shortcut keys and get the config to look like this. You might have to add temoprary Karabiner simple remappings to be able to type these:

image image

Rectangle setup

Likewise, may need temporary remappings to be able to type these:

image

OSX Shortcut Setup

Basically, turn everything off except the shortcuts in the following screenshots.

Important: the shortcuts in the "Windows" section are still active even when disabled(?!). You have to map them to nonsense or obscure combos so OSX stops intercepting them, like this:

image

Other surviving shortcuts (many remapped to sensible values):

image image image
{
"description": "Remap Control+Tab to Right Control+F16 for Alt Tab",
"manipulators": [
{
"from": {
"key_code": "tab",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{
"key_code": "f16",
"modifiers": ["right_control"]
}
],
"type": "basic"
},
{
"from": {
"key_code": "tab",
"modifiers": { "mandatory": ["control", "shift"] }
},
"to": [
{
"key_code": "f16",
"modifiers": ["right_control", "shift"]
}
],
"type": "basic"
}
]
}
{
"description": "Remap Command+Tab to Control+Tab",
"manipulators": [
{
"from": {
"key_code": "tab",
"modifiers": { "mandatory": ["command"] }
},
"to": [
{
"key_code": "tab",
"modifiers": ["control"]
}
],
"type": "basic"
},
{
"from": {
"key_code": "tab",
"modifiers": { "mandatory": ["command", "shift"] }
},
"to": [
{
"key_code": "tab",
"modifiers": ["control", "shift"]
}
],
"type": "basic"
}
]
}
{
"description": "Option + T → launch/new window Ghostty.",
"manipulators": [
{
"from": {
"key_code": "t",
"modifiers": {
"mandatory": ["option"],
"optional": []
}
},
"to": [{ "shell_command": "open -a Ghostty" }],
"type": "basic"
}
]
}
{
"description": "Option + L → lock screen.",
"manipulators": [
{
"from": {
"key_code": "l",
"modifiers": {
"mandatory": ["option"],
"optional": []
}
},
"to": [
{
"key_code": "q",
"modifiers": ["control", "command"]
}
],
"type": "basic"
}
]
}
{
"description": "Modifier remaps + macOS text navigation + Rectangle arrows",
"manipulators": [
{
"from": {
"key_code": "left_arrow",
"modifiers": {
"mandatory": ["option"],
"optional": []
}
},
"to": [{ "key_code": "f17" }],
"type": "basic"
},
{
"from": {
"key_code": "right_arrow",
"modifiers": {
"mandatory": ["option"],
"optional": []
}
},
"to": [{ "key_code": "f18" }],
"type": "basic"
},
{
"from": {
"key_code": "up_arrow",
"modifiers": {
"mandatory": ["option"],
"optional": []
}
},
"to": [{ "key_code": "f19" }],
"type": "basic"
},
{
"from": {
"key_code": "down_arrow",
"modifiers": {
"mandatory": ["option"],
"optional": []
}
},
"to": [{ "key_code": "f20" }],
"type": "basic"
},
{
"description": "Right Cmd + Left Arrow → jump back one word.",
"from": {
"key_code": "left_arrow",
"modifiers": {
"mandatory": ["right_command"],
"optional": []
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["option"]
}
],
"type": "basic"
},
{
"description": "Right Cmd + Right Arrow → jump forward one word.",
"from": {
"key_code": "right_arrow",
"modifiers": {
"mandatory": ["right_command"],
"optional": []
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["option"]
}
],
"type": "basic"
},
{
"description": "Right Cmd + Backspace → delete previous word.",
"from": {
"key_code": "delete_or_backspace",
"modifiers": {
"mandatory": ["right_command"],
"optional": []
}
},
"to": [
{
"key_code": "delete_or_backspace",
"modifiers": ["option"]
}
],
"type": "basic"
}
]
}
{
"description": "Option+E opens Finder or new Finder window",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.apple\\.finder$"
],
"type": "frontmost_application_if"
}
],
"from": {
"key_code": "e",
"modifiers": {
"mandatory": ["option"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "n",
"modifiers": ["command"]
}
],
"type": "basic"
},
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.apple\\.finder$"
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "e",
"modifiers": {
"mandatory": ["option"],
"optional": ["any"]
}
},
"to": [{ "shell_command": "open -a Finder" }],
"type": "basic"
}
]
}
{
"description": "Option+Semicolon opens Emoji Picker",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "semicolon",
"modifiers": {
"mandatory": ["option"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "spacebar",
"modifiers": [
"left_control",
"left_command"
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment