Skip to content

Instantly share code, notes, and snippets.

@andreyka26-git
Last active February 5, 2026 16:25
Show Gist options
  • Select an option

  • Save andreyka26-git/0505e58e1eff8890f2040fc0e127396b to your computer and use it in GitHub Desktop.

Select an option

Save andreyka26-git/0505e58e1eff8890f2040fc0e127396b to your computer and use it in GitHub Desktop.
Karabiner vim setup (mac)
{
"description": "Windows Keyboard Fix + Vim Navigation (Caps/Right-Alt)",
"manipulators": [
{
"description": "Caps Lock: Hold for Vim Mode, Tap for Escape",
"from": {
"key_code": "caps_lock",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"set_variable": {
"name": "vim_mode",
"value": 1
}
}
],
"to_after_key_up": [
{
"set_variable": {
"name": "vim_mode",
"value": 0
}
}
],
"to_if_alone": [{ "key_code": "escape" }],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "h",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "left_arrow" }],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "j",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "down_arrow" }],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "k",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "up_arrow" }],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "l",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "right_arrow" }],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "u",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "page_up" }],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "f",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "page_down" }],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "w",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["left_option"]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "b",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["left_option"]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "e",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["left_option"]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "d",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "page_down" }],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "y",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "c",
"modifiers": ["left_command"]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "p",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "v",
"modifiers": ["left_command"]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "4",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["left_command"]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "vim_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "hyphen",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["left_command"]
}
],
"type": "basic"
},
{
"description": "Right Command (Right Alt) Navigation",
"from": {
"key_code": "h",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{ "key_code": "left_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "j",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{ "key_code": "down_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "k",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{ "key_code": "up_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "l",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [{ "key_code": "right_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "4",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["left_command"]
}
],
"type": "basic"
},
{
"from": {
"key_code": "hyphen",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["left_command"]
}
],
"type": "basic"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment