Skip to content

Instantly share code, notes, and snippets.

@pirj
Last active September 16, 2019 18:07
Show Gist options
  • Save pirj/fe17a45e182acea934576c547bdc277e to your computer and use it in GitHub Desktop.
Save pirj/fe17a45e182acea934576c547bdc277e to your computer and use it in GitHub Desktop.
Karabiner complex modiications: Vi'ish mode
{
"title": "F + HJKL",
"rules": [
{
"description": "Vi'ish Mode [F as Trigger Key]",
"manipulators": [
{
"type": "basic",
"parameters": {
"basic.to_delayed_action_delay_milliseconds": 150,
"basic.to_if_held_down_threshold_milliseconds": 150
},
"from": { "key_code": "f", "modifiers": { } },
"to_if_alone": [ { "key_code": "f" } ],
"to_if_held_down": [ { "set_variable": { "name": "vi_mode", "value": 1 }, "halt": true } ],
"to_after_key_up": [ { "set_variable": { "name": "vi_mode", "value": 0 } } ],
"to_delayed_action": { "to_if_canceled": [ { "key_code": "f" }, { "set_variable": { "name": "vi_mode", "value": 0 } } ] }
},
{
"type": "basic",
"from": { "key_code": "j", "modifiers": { "optional": [ "any" ] } },
"to": [ { "key_code": "down_arrow" } ],
"conditions": [ { "type": "variable_if", "name": "vi_mode", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "k", "modifiers": { "optional": [ "any" ] } },
"to": [ { "key_code": "up_arrow" } ],
"conditions": [ { "type": "variable_if", "name": "vi_mode", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "h", "modifiers": { "optional": [ "any" ] } },
"to": [ { "key_code": "left_arrow" } ],
"conditions": [ { "type": "variable_if", "name": "vi_mode", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "l", "modifiers": { "optional": [ "any" ] } },
"to": [ { "key_code": "right_arrow" } ],
"conditions": [ { "type": "variable_if", "name": "vi_mode", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "b", "modifiers": { "optional": [ "any" ] } },
"to": [ { "key_code": "left_arrow", "modifiers": [ "left_option" ] } ],
"conditions": [ { "type": "variable_if", "name": "vi_mode", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "w", "modifiers": { "optional": [ "any" ] } },
"to": [ { "key_code": "right_arrow", "modifiers": [ "left_option" ] } ],
"conditions": [ { "type": "variable_if", "name": "vi_mode", "value": 1 } ]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment