macos鍵盤映射修改


在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中看到。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM