This complex modification changes HJKL to Vim style arrow keys when "D" is held down. Please adjust Karabiner Elements' simultaneous_threshold_milliseconds to between 150-500ms for this to work correctly. I'm currently using a value of 250.
Created
September 11, 2019 16:59
-
-
Save davidhemphill/64ee698c4c628e322c5b38cac123e352 to your computer and use it in GitHub Desktop.
Change D+HJKL to arrow keys (for Karabiner Elements)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "title": "HEMP Vim Arrows", | |
| "rules": [ | |
| { | |
| "description": "D+HJKL as arrow keys", | |
| "manipulators": [ | |
| { | |
| "type": "basic", | |
| "from": { | |
| "key_code": "j", | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "down_arrow", | |
| "modifiers": [] | |
| } | |
| ], | |
| "conditions": [ | |
| { | |
| "type": "variable_if", | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "simultaneous": [ | |
| { | |
| "key_code": "d" | |
| }, | |
| { | |
| "key_code": "j" | |
| } | |
| ], | |
| "simultaneous_options": { | |
| "key_down_order": "strict", | |
| "key_up_order": "strict_inverse", | |
| "detect_key_down_uninterruptedly": true, | |
| "to_after_key_up": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 0 | |
| } | |
| } | |
| ] | |
| }, | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| }, | |
| { | |
| "key_code": "down_arrow", | |
| "modifiers": [] | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "key_code": "k", | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "up_arrow", | |
| "modifiers": [] | |
| } | |
| ], | |
| "conditions": [ | |
| { | |
| "type": "variable_if", | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "simultaneous": [ | |
| { | |
| "key_code": "d" | |
| }, | |
| { | |
| "key_code": "k" | |
| } | |
| ], | |
| "simultaneous_options": { | |
| "key_down_order": "strict", | |
| "key_up_order": "strict_inverse", | |
| "detect_key_down_uninterruptedly": true, | |
| "to_after_key_up": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 0 | |
| } | |
| } | |
| ] | |
| }, | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| }, | |
| { | |
| "key_code": "up_arrow", | |
| "modifiers": [] | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "key_code": "h", | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "left_arrow", | |
| "modifiers": [] | |
| } | |
| ], | |
| "conditions": [ | |
| { | |
| "type": "variable_if", | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "simultaneous": [ | |
| { | |
| "key_code": "d" | |
| }, | |
| { | |
| "key_code": "h" | |
| } | |
| ], | |
| "simultaneous_options": { | |
| "key_down_order": "strict", | |
| "key_up_order": "strict_inverse", | |
| "detect_key_down_uninterruptedly": true, | |
| "to_after_key_up": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 0 | |
| } | |
| } | |
| ] | |
| }, | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| }, | |
| { | |
| "key_code": "left_arrow", | |
| "modifiers": [] | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "key_code": "l", | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "right_arrow", | |
| "modifiers": [] | |
| } | |
| ], | |
| "conditions": [ | |
| { | |
| "type": "variable_if", | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "simultaneous": [ | |
| { | |
| "key_code": "d" | |
| }, | |
| { | |
| "key_code": "l" | |
| } | |
| ], | |
| "simultaneous_options": { | |
| "key_down_order": "strict", | |
| "key_up_order": "strict_inverse", | |
| "detect_key_down_uninterruptedly": true, | |
| "to_after_key_up": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 0 | |
| } | |
| } | |
| ] | |
| }, | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| }, | |
| { | |
| "key_code": "right_arrow", | |
| "modifiers": [] | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "key_code": "f", | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "fn", | |
| "modifiers": [] | |
| } | |
| ], | |
| "conditions": [ | |
| { | |
| "type": "variable_if", | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "simultaneous": [ | |
| { | |
| "key_code": "d" | |
| }, | |
| { | |
| "key_code": "f" | |
| } | |
| ], | |
| "simultaneous_options": { | |
| "key_down_order": "strict", | |
| "key_up_order": "strict_inverse", | |
| "detect_key_down_uninterruptedly": true, | |
| "to_after_key_up": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 0 | |
| } | |
| } | |
| ] | |
| }, | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| }, | |
| { | |
| "key_code": "fn", | |
| "modifiers": [] | |
| } | |
| ] | |
| }, | |
| { | |
| "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": { | |
| "simultaneous": [ | |
| { | |
| "key_code": "d" | |
| }, | |
| { | |
| "key_code": "b" | |
| } | |
| ], | |
| "simultaneous_options": { | |
| "key_down_order": "strict", | |
| "key_up_order": "strict_inverse", | |
| "detect_key_down_uninterruptedly": true, | |
| "to_after_key_up": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 0 | |
| } | |
| } | |
| ] | |
| }, | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| }, | |
| { | |
| "key_code": "left_arrow", | |
| "modifiers": ["left_option"] | |
| } | |
| ] | |
| }, | |
| { | |
| "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 | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "simultaneous": [ | |
| { | |
| "key_code": "d" | |
| }, | |
| { | |
| "key_code": "w" | |
| } | |
| ], | |
| "simultaneous_options": { | |
| "key_down_order": "strict", | |
| "key_up_order": "strict_inverse", | |
| "detect_key_down_uninterruptedly": true, | |
| "to_after_key_up": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 0 | |
| } | |
| } | |
| ] | |
| }, | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| }, | |
| { | |
| "key_code": "right_arrow", | |
| "modifiers": ["left_option"] | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "key_code": "0", | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "a", | |
| "modifiers": ["left_control"] | |
| } | |
| ], | |
| "conditions": [ | |
| { | |
| "type": "variable_if", | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "simultaneous": [ | |
| { | |
| "key_code": "d" | |
| }, | |
| { | |
| "key_code": "0" | |
| } | |
| ], | |
| "simultaneous_options": { | |
| "key_down_order": "strict", | |
| "key_up_order": "strict_inverse", | |
| "detect_key_down_uninterruptedly": true, | |
| "to_after_key_up": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 0 | |
| } | |
| } | |
| ] | |
| }, | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| }, | |
| { | |
| "key_code": "a", | |
| "modifiers": ["left_control"] | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "key_code": "4", | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "e", | |
| "modifiers": ["left_control"] | |
| } | |
| ], | |
| "conditions": [ | |
| { | |
| "type": "variable_if", | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "basic", | |
| "from": { | |
| "simultaneous": [ | |
| { | |
| "key_code": "d" | |
| }, | |
| { | |
| "key_code": "4" | |
| } | |
| ], | |
| "simultaneous_options": { | |
| "key_down_order": "strict", | |
| "key_up_order": "strict_inverse", | |
| "detect_key_down_uninterruptedly": true, | |
| "to_after_key_up": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 0 | |
| } | |
| } | |
| ] | |
| }, | |
| "modifiers": { | |
| "optional": ["any"] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "set_variable": { | |
| "name": "vi_mode", | |
| "value": 1 | |
| } | |
| }, | |
| { | |
| "key_code": "e", | |
| "modifiers": ["left_control"] | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment