在windows下,我使用AutoHotkey (AHK)進行鍵盤映射,AHK不支持macos,所以重新選了一款軟件,這款軟件是Karabiner-Elements。
要把鍵位映射成什么樣子?
如下圖:
這樣基本就可以實現在編輯東西的時候不需要使用鼠標了。
配置Karabiner-Elements
vi方式的上下左右使用官網帶的(Add rule->import from internet)就可以了。其余的我自己創造一下。
進入目錄~/.config/karabiner/assets/complex_modifications
中,新建一個my.json
文件,寫入如下內容:
{
"title": "my_key_map",
"rules": [
{
"description": "my_key_map",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "u",
"modifiers": {
"mandatory": [ "command" ],
"optional": [ "any" ]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "y",
"modifiers": {
"mandatory": [ "command" ],
"optional": [ "any" ]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"command",
"shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "i",
"modifiers": {
"mandatory": [ "command" ],
"optional": [ "any" ]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "o",
"modifiers": {
"mandatory": [ "command" ],
"optional": [ "any" ]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"command",
"shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "comma",
"modifiers": {
"mandatory": [ "command" ],
"optional": [ "any" ]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "period",
"modifiers": {
"mandatory": [ "command" ],
"optional": [ "any" ]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"shift"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "d",
"modifiers": {
"mandatory": [ "command" ],
"optional": [ "any" ]
}
},
"to": [
{
"key_code": "delete_forward"
}
]
}
]
}
]
}
然后在Add rule
時就可以看到該配置項,Enable它即可。
配置文件說明
其實不需要太多說明,根據已有的配置文件猜一猜,改一改就可以了。
備注
各個鍵對應的英文名是什么?
可以在Karabiner-Elements的Simple modifications中看到。