Skip to content

Instantly share code, notes, and snippets.

@kxccc
Last active January 15, 2024 15:30
Show Gist options
  • Save kxccc/f38351a59ae3ed3a56fa9dc018d9415e to your computer and use it in GitHub Desktop.
Save kxccc/f38351a59ae3ed3a56fa9dc018d9415e to your computer and use it in GitHub Desktop.
{
"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": "Left ctrl + hjkl to arrow keys Vim",
"manipulators": [
{
"from": {
"key_code": "h",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "j",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "k",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "l",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
}
]
}
]
}
@kxccc
Copy link
Author

kxccc commented Sep 16, 2023

karabiner://karabiner/assets/complex_modifications/import?url=json url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment