Skip to content

Instantly share code, notes, and snippets.

@xgenvn
Created July 17, 2020 02:07
Show Gist options
  • Select an option

  • Save xgenvn/9c7b0c3f15e9fc2ba07b5fbbad1d5c23 to your computer and use it in GitHub Desktop.

Select an option

Save xgenvn/9c7b0c3f15e9fc2ba07b5fbbad1d5c23 to your computer and use it in GitHub Desktop.
Karabiner - Dev Mode
{
"title": "Use CAPS LOCK for vi navigation",
"rules": [
{
"description": "CAPS LOCK + awsd to arrow keys; CAPS+c to ESC; CAPS+2 to SHIFT+FN+F6",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "c",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "escape"
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "2",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "f6",
"modifiers": ["left_shift", "fn"]
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "v",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "v",
"modifiers": ["left_shift"]
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "s",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "w",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "d",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"set_variable": {
"name": "caps_lock pressed",
"value": 1
}
}
],
"to_after_key_up": [
{
"set_variable": {
"name": "caps_lock pressed",
"value": 0
}
}
]
}
]
},
{
"description": "CAPS LOCK + shift + hjkl to scroll",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "s",
"modifiers": {
"mandatory": ["shift"]
}
},
"to": [
{
"mouse_key": {
"vertical_wheel": 40
}
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "w",
"modifiers": {
"mandatory": ["shift"]
}
},
"to": [
{
"mouse_key": {
"vertical_wheel": -40
}
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": ["shift"]
}
},
"to": [
{
"mouse_key": {
"horizontal_wheel": -30
}
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "d",
"modifiers": {
"mandatory": ["shift"]
}
},
"to": [
{
"mouse_key": {
"horizontal_wheel": -30
}
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"set_variable": {
"name": "caps_lock pressed",
"value": 1
}
}
],
"to_after_key_up": [
{
"set_variable": {
"name": "caps_lock pressed",
"value": 0
}
}
]
}
]
}
]
}
{
"title": "Exchange [;'",
"rules": [
{
"description": "Exchange common keys: [;'",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "open_bracket",
"modifiers": {
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "open_bracket",
"modifiers": ["left_shift"]
}
]
},
{
"type": "basic",
"from": {
"key_code": "open_bracket",
"modifiers": {
"mandatory": ["shift"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "open_bracket"
}
]
},
{
"type": "basic",
"from": {
"key_code": "close_bracket",
"modifiers": {
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "close_bracket",
"modifiers": ["left_shift"]
}
]
},
{
"type": "basic",
"from": {
"key_code": "close_bracket",
"modifiers": {
"mandatory": ["shift"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "close_bracket"
}
]
},
{
"type": "basic",
"from": {
"key_code": "semicolon",
"modifiers": {
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "semicolon",
"modifiers": ["left_shift"]
}
]
},
{
"type": "basic",
"from": {
"key_code": "semicolon",
"modifiers": {
"mandatory": ["shift"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "semicolon"
}
]
},
{
"type": "basic",
"from": {
"key_code": "quote",
"modifiers": {
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "quote",
"modifiers": ["left_shift"]
}
]
},
{
"type": "basic",
"from": {
"key_code": "quote",
"modifiers": {
"mandatory": ["shift"],
"optional": ["caps_lock"]
}
},
"to": [
{
"key_code": "quote"
}
]
}
]
}
]
}
{
"title": "Exchange numbers and symbols",
"rules": [
{
"description": "Exchange numbers and symbols (1234567890 and !@#$%^&*())",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "1",
"modifiers": {
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "1",
"modifiers": [
"left_shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "2",
"modifiers": {
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "2",
"modifiers": [
"left_shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "3",
"modifiers": {
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "3",
"modifiers": [
"left_shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "4",
"modifiers": {
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "4",
"modifiers": [
"left_shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "5",
"modifiers": {
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "5",
"modifiers": [
"left_shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "6",
"modifiers": {
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "6",
"modifiers": [
"left_shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "7",
"modifiers": {
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "7",
"modifiers": [
"left_shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "8",
"modifiers": {
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "8",
"modifiers": [
"left_shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "9",
"modifiers": {
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "9",
"modifiers": [
"left_shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "0",
"modifiers": {
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "0",
"modifiers": [
"left_shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "1",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "1"
}
]
},
{
"type": "basic",
"from": {
"key_code": "2",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "2"
}
]
},
{
"type": "basic",
"from": {
"key_code": "3",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "3"
}
]
},
{
"type": "basic",
"from": {
"key_code": "4",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "4"
}
]
},
{
"type": "basic",
"from": {
"key_code": "5",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "5"
}
]
},
{
"type": "basic",
"from": {
"key_code": "6",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "6"
}
]
},
{
"type": "basic",
"from": {
"key_code": "7",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "7"
}
]
},
{
"type": "basic",
"from": {
"key_code": "8",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "8"
}
]
},
{
"type": "basic",
"from": {
"key_code": "9",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "9"
}
]
},
{
"type": "basic",
"from": {
"key_code": "0",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "0"
}
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment