之前我一直用Windows或Linux,後來新工作使用Mac OS,感覺還是有很多不習慣的地方。特別是一些常用的快捷鍵,比如複製、粘貼等快捷鍵,在Windows下是使用ctrl鍵,而在Mac OS下是使用command鍵。而且我還使用Windows虛擬機,經常需要來回切換快捷鍵,使用很不習慣。最近網上搜索到一個軟件可以修改快捷鍵映射,完美解決這個問題。現記錄一下:
- 下載並安裝一個軟件 Karabiner-Elements,地址。
- 軟件打開的界面如下:
- 點擊 “Complex modifications”,出現的界面如下:
- 點擊 “Add rule”,出現界面如下:
- 點擊 “import more rules from the internet”,會打開一個頁面
- 點擊頁面的“import” 導入規則,導入成功後,可以看到新增的如下兩條規則:
- 點擊第一條規則的 “Enable” ,使用這條規則。
這條規則會立即將鍵盤上左邊的 ctrl + 字母鍵 映射爲 command + 字母鍵。大功告成!
如果要去掉多餘的映射關係,則直接修改~/.config/karabiner/assets/complex_modifications/1575427520.json
這個文件,把不需要的映射關係去掉,只保留常用的即可,如下所示:
{
"title": "Change control + letter keys to command + letter keys",
"rules": [
{
"description": "Change left_control + letter to left_command + letter",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "a",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "b",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "b",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "c",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "c",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "f",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "f",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "h",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "h",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "n",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "n",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "o",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "o",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "s",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "s",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "v",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "v",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "x",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "x",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "y",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "y",
"modifiers": [
"left_command"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "z",
"modifiers": {
"mandatory": ["left_control"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "z",
"modifiers": [
"left_command"
]
}
]
}
]
}
]
}
如果要取消鍵的映射,則刪除這條規則即可。
這個軟件的功能非常強大,可以定製鍵盤所有的按鍵功能,根據需要可以參考官方文檔深入研究。