Last active
September 20, 2024 06:12
-
-
Save kxccc/f38351a59ae3ed3a56fa9dc018d9415e to your computer and use it in GitHub Desktop.
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": "适合 HHKB 和 Vim 用户的键盘映射", | |
"rules": [ | |
{ | |
"description": "短按 Control_L -> ESC 并切换英文输入法", | |
"manipulators": [ | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "en" | |
} | |
], | |
"type": "input_source_unless" | |
} | |
], | |
"from": { | |
"key_code": "left_control" | |
}, | |
"to": [ | |
{ | |
"key_code": "left_control", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "escape" | |
}, | |
{ | |
"key_code": "f18" | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_control" | |
} | |
], | |
"type": "basic" | |
}, | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "en" | |
} | |
], | |
"type": "input_source_if" | |
} | |
], | |
"from": { | |
"key_code": "left_control" | |
}, | |
"to": [ | |
{ | |
"key_code": "left_control", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "escape" | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_control" | |
} | |
], | |
"type": "basic" | |
} | |
] | |
}, | |
{ | |
"description": "短按 Caps -> ESC 并切换英文输入法 | 其它情况 Caps -> Control_L", | |
"manipulators": [ | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "en" | |
} | |
], | |
"type": "input_source_unless" | |
} | |
], | |
"from": { | |
"key_code": "caps_lock", | |
"modifiers": { | |
"optional": ["any"] | |
} | |
}, | |
"to": [ | |
{ | |
"key_code": "left_control", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "escape" | |
}, | |
{ | |
"key_code": "f18" | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_control" | |
} | |
], | |
"type": "basic" | |
}, | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "en" | |
} | |
], | |
"type": "input_source_if" | |
} | |
], | |
"from": { | |
"key_code": "caps_lock", | |
"modifiers": { | |
"optional": ["any"] | |
} | |
}, | |
"to": [ | |
{ | |
"key_code": "left_control", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "escape" | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_control" | |
} | |
], | |
"type": "basic" | |
} | |
] | |
}, | |
{ | |
"description": "短按 Command_L -> 切换英文输入法", | |
"manipulators": [ | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "en" | |
} | |
], | |
"type": "input_source_unless" | |
} | |
], | |
"from": { | |
"key_code": "left_command" | |
}, | |
"to": [ | |
{ | |
"key_code": "left_command", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "f18" | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_command" | |
} | |
], | |
"type": "basic" | |
}, | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "en" | |
} | |
], | |
"type": "input_source_if" | |
} | |
], | |
"from": { | |
"key_code": "left_command" | |
}, | |
"to": [ | |
{ | |
"key_code": "left_command", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "vk_none" | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_command" | |
} | |
], | |
"type": "basic" | |
} | |
] | |
}, | |
{ | |
"description": "短按 Command_R -> 切换中文输入法", | |
"manipulators": [ | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "zh-Hans" | |
} | |
], | |
"type": "input_source_unless" | |
} | |
], | |
"from": { | |
"key_code": "right_command" | |
}, | |
"to": [ | |
{ | |
"key_code": "right_command", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "f18" | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "right_command" | |
} | |
], | |
"type": "basic" | |
}, | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "zh-Hans" | |
} | |
], | |
"type": "input_source_if" | |
} | |
], | |
"from": { | |
"key_code": "right_command" | |
}, | |
"to": [ | |
{ | |
"key_code": "right_command", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "vk_none" | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "right_command" | |
} | |
], | |
"type": "basic" | |
} | |
] | |
}, | |
{ | |
"description": "搭配 Homerow 使用,短按 Option_R 点击,长按 Option_R 滚动", | |
"manipulators": [ | |
{ | |
"from": { | |
"key_code": "right_option" | |
}, | |
"parameters": { | |
"basic.to_if_alone_timeout_milliseconds": 170, | |
"basic.to_if_held_down_threshold_milliseconds": 170 | |
}, | |
"to": [ | |
{ | |
"key_code": "right_option", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "spacebar", | |
"modifiers": ["left_command", "left_shift"] | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "j", | |
"modifiers": ["left_command", "left_shift"] | |
} | |
], | |
"type": "basic" | |
} | |
] | |
}, | |
{ | |
"description": "Right Command + hjkl to arrow keys Vim", | |
"manipulators": [ | |
{ | |
"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" | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ps: 如果只想设置 esc 切换英文输入法的话,用这个karabiner设置: https://gist.github.com/Jackiexiao/243468b2dbb8017af6a7baefb7af0ed2