Skip to content

Instantly share code, notes, and snippets.

@parMaster
Last active February 24, 2025 12:35
Show Gist options
  • Save parMaster/ab391983151314a6532c99248ff7c75a to your computer and use it in GitHub Desktop.
Save parMaster/ab391983151314a6532c99248ff7c75a to your computer and use it in GitHub Desktop.
Karabiner configuration. Right Command = Hyper key. Hyper + {I, J, K, L} = {↑, ←, ↓, →}; ----- Hyper + {U, O} = {Home, End}; ----- Hyper + {;, p} = {Enter, Backspace}; ----- Hyper + {Y, H} = {PgUp, PgDown}; Quit app by command-q twice; Quit app by holding command-q; ----- Hyper + {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =} = {F1-F12}

Ergonomic Keyboard Mappings for macOS

Stop moving your hand every time you need to use arrow keys:

  • Your right point finger is already on the J key
  • Press and hold a hyper key (right Command pressed with a thumb, just like a space key - in my config)
  • Use IJKL like arrow keys

Additional features:

  • Home/End navigation: Hyper + U/O moves cursor to start/end of line
  • Page navigation: Hyper + Y/H for Page Up/Down
  • Quick delete: Hyper + P for backspace, Hyper + Shift + P for forward delete
  • Smart delete: Hyper + Option + P for delete word, Hyper + Command + P for delete to line start
  • Quick enter: Hyper + ; (semicolon) acts as Enter key
  • Function keys: Hyper + number keys (1-0, -, =) work as F1-F12
  • Backtick access: Option + Escape types backtick (`)
  • Window switching: Command + Escape switches between windows of the same app
  • Language switch: Language switch on Shift keys tap (pressed alone for <250ms) (left: EN, right:UA), normal shift otherwise
  • Safe quit: Press Command + Q twice to quit applications (prevents accidental quits)
    • Also works by holding Command + Q
{"profiles": [{
"complex_modifications": {
"rules": [
{ "description" : "left_option + escape = grave_accent_and_tilde",
"manipulators": [
{ "from": { "key_code": "escape",
"modifiers": { "mandatory": ["left_option"],
"optional" : ["shift", "left_command"] }},
"to" : [{ "key_code": "grave_accent_and_tilde" }],
"type": "basic" }
]},
{ "description" : "Shift + ⌫ = ⌦",
"manipulators": [
{ "from": { "key_code": "delete_or_backspace", "modifiers": {"mandatory": ["shift"]} },
"to" : [{ "key_code": "delete_forward" }],
"type": "basic" }
]},
{ "description" : "left_command + escape = Switch Windows (Ctrl+Tab)",
"manipulators": [
{ "from": { "key_code": "escape", "modifiers": {"mandatory": ["left_command"]} },
"to" : [{ "key_code": "grave_accent_and_tilde", "modifiers": ["left_command"] }],
"type": "basic" }
]},
{ "description" : "Hyper = Right Command",
"manipulators": [
{ "from" : { "key_code": "right_command", "modifiers": {"optional": ["any"]} },
"to" : [{ "set_variable": {"name": "hyper_mod", "value": 1} }],
"to_after_key_up": [{ "set_variable": {"name": "hyper_mod", "value": 0} }],
"type" : "basic" }
]},
{ "description" : "Hyper + {I, J, K, L} = {↑, ←, ↓, →}",
"manipulators": [
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "i", "modifiers": {"optional": ["shift", "left_command", "left_option"]} },
"to" : [{ "key_code": "up_arrow" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "j", "modifiers": {"optional": ["shift", "left_command", "left_option"]} },
"to" : [{ "key_code": "left_arrow" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "k", "modifiers": {"optional": ["shift", "left_command", "left_option"]} },
"to" : [{ "key_code": "down_arrow" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "l", "modifiers": {"optional": ["shift", "left_command", "left_option"]} },
"to" : [{ "key_code": "right_arrow" }],
"type" : "basic" }
]},
{ "description" : "Hyper + {U, O} = {Home, End}",
"manipulators": [
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "u", "modifiers": {"optional": ["shift", "left_command"]} },
"to" : { "key_code": "left_arrow", "modifiers": ["left_command"] },
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "o", "modifiers": {"optional": ["shift", "left_command"]} },
"to" : { "key_code": "right_arrow", "modifiers": ["left_command"] },
"type" : "basic" }
]},
{ "description" : "Hyper + {Y, H} = {PgUp, PgDown}",
"manipulators": [
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "y", "modifiers": {"optional": ["shift"]} },
"to" : [{ "key_code": "page_up" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "h", "modifiers": {"optional": ["shift"]} },
"to" : [{ "key_code": "page_down" }],
"type" : "basic" }
]},
{ "description" : "Hyper + {;, p} = {Enter, Backspace}",
"manipulators": [
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "semicolon", "modifiers": {"optional": ["shift"]} },
"to" : [{ "key_code": "return_or_enter" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "p", "modifiers": {} },
"to" : [{ "key_code": "delete_or_backspace" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "p", "modifiers": {"mandatory": ["shift"]} },
"to" : [{ "key_code": "delete_forward" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "p", "modifiers": {"mandatory": ["option"]} },
"to" : [{ "key_code": "delete_or_backspace", "modifiers": "option" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "p", "modifiers": {"mandatory": ["command"]} },
"to" : [{ "key_code": "delete_or_backspace", "modifiers": "command" }],
"type" : "basic" }
]},
{ "description" : "Hyper + {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =} = {F1-F12}",
"manipulators": [
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "1", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f1" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "2", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f2" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "3", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f3" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "4", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f4" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "5", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f5" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "6", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f6" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "7", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f7" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "8", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f8" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "9", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f9" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "0", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f10" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "hyphen", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f11" }],
"type" : "basic" },
{ "conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "equal_sign", "modifiers": {"optional": ["shift", "left_command", "left_option", "left_control"]} },
"to" : [{ "key_code": "f12" }],
"type" : "basic" }
]},
{ "description" : "Quit application by pressing command-q twice",
"manipulators": [
{ "conditions": [{ "name": "command-q", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "q", "modifiers": {"mandatory": ["command"], "optional": ["caps_lock"]} },
"to" : [{ "key_code": "q", "modifiers": "left_command" }],
"type" : "basic" },
{ "from" : { "key_code": "q", "modifiers": {"mandatory": ["command"], "optional": ["caps_lock"]} },
"to" : [{ "set_variable": {"name": "command-q", "value": 1} }],
"to_delayed_action": {
"to_if_canceled": [{ "set_variable": {"name": "command-q", "value": 0} }],
"to_if_invoked" : [{ "set_variable": {"name": "command-q", "value": 0} }]
},
"type" : "basic" }
]},
{ "description" : "Quit application by holding command-q",
"manipulators": [
{ "from" : { "key_code": "q", "modifiers": {"mandatory": ["command"], "optional": ["caps_lock"]} },
"to_if_held_down": [{ "key_code": "q", "modifiers": ["left_command"], "repeat": false }],
"type" : "basic" }
]},
{ "description": "[HyperIJKL] Input Language Selection",
"manipulators": [
{
"description": "Hyper + space -> Language Switch (Previous Input Language)",
"conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "spacebar", "modifiers": {"optional": ["caps_lock"]} },
"to" : [{ "key_code": "spacebar", "modifiers": "left_control" }],
"type" : "basic"
},
{
"description": "comma -> EN",
"conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "comma", "modifiers": {"optional": ["caps_lock"]} },
"to" : [{ "select_input_source": {"language": "en"}}],
"type" : "basic"
},
{
"description": "period -> UA",
"conditions": [{ "name": "hyper_mod", "type": "variable_if", "value": 1 }],
"from" : { "key_code": "period", "modifiers": {"optional": ["caps_lock"]} },
"to" : [{ "select_input_source": {"language": "uk"}}],
"type" : "basic"}
]},
{ "description": "Shifts: Language switch on tap (left: EN, right:UA), normal shift on hold",
"manipulators": [
{
"description": "Left Shift tap -> EN",
"from" : { "key_code": "left_shift", "modifiers": { "optional": ["any"] } },
"parameters" : { "basic.to_if_alone_timeout_milliseconds": 250 },
"to" : [{ "key_code": "left_shift" }],
"to_if_alone": [{ "select_input_source": { "language": "en" } }],
"type": "basic"
},
{
"description": "Right Shift tap -> Ukrainian (uk)",
"from" : { "key_code": "right_shift", "modifiers": { "optional": ["any"] } },
"parameters" : { "basic.to_if_alone_timeout_milliseconds": 250 },
"to" : [{ "key_code": "right_shift" }],
"to_if_alone": [{ "select_input_source": { "language": "uk" } }],
"type": "basic"}
]}
]
},
"fn_function_keys": [
{ "from": { "key_code": "f1" },
"to": [{"key_code": "vk_consumer_brightness_down"}]},
{ "from": { "key_code": "f2" },
"to": [{"key_code": "vk_consumer_brightness_up"}]},
{ "from": { "key_code": "f3" },
"to": [{"key_code": "vk_mission_control"}]},
{ "from": { "key_code": "f4" },
"to": [{"key_code": "vk_launchpad"}]},
{ "from": { "key_code": "f5" },
"to": [{"key_code": "vk_consumer_illumination_down"}]},
{ "from": { "key_code": "f6" },
"to": [{"key_code": "vk_consumer_illumination_up"}]},
{ "from": { "key_code": "f7" },
"to": [{"key_code": "vk_consumer_previous"}]},
{ "from": { "key_code": "f8" },
"to": [{"key_code": "vk_consumer_play"}]},
{ "from": { "key_code": "f9" },
"to": [{"key_code": "vk_consumer_next"}]},
{ "from": { "key_code": "f10" },
"to": [{"key_code": "mute"}]},
{ "from": { "key_code": "f11" },
"to": [{"key_code": "volume_down"}]},
{ "from": { "key_code": "f12" },
"to": [{"key_code": "volume_up"}]}
],
"name": "Default profile",
"selected": true,
"virtual_hid_keyboard": {
"caps_lock_delay_milliseconds": 0,
"country_code": 0,
"keyboard_type": "ansi",
"keyboard_type_v2": "ansi"
}
}]}
@parMaster
Copy link
Author

Added:

  • Command + p -> Command + Backspace
  • Option + p -> Option + Backspace
  • Shift + p -> Shift + Backspace (delete)

@parMaster
Copy link
Author

Using HTK-667 + MBP as a primary input now, added:

left_option + escape = grave_accent_and_tilde
left_command + escape = Switch Windows (Ctrl+"key left to 1 on MBP ISO keyboard")

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