macOS修改方向键

2020-06-09  本文已影响0人  梨花菜

1.下载改键器Karabiner-Elements

2.功能说明

配置文件说明:
CapsLock指的是切换大小写的CapsLock按键,一般都是在A键的左边第一个

2.1方向键组合

2.2功能键组合

3.新增自定义配置

配置文件内容:

{
  "title": "Use CAPS LOCK for vi navigation",
  "rules": [
    {
      "description": "CAPS LOCK + jkli to arrow keys",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "j",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "caps_lock pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "k",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "down_arrow"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "caps_lock pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "i",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "up_arrow"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "caps_lock pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "l",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "caps_lock pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "h",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "delete_or_backspace"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "caps_lock pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "m",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "home"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "caps_lock pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "e",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "end"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "caps_lock pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "u",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "page_up"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "caps_lock pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "d",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "page_down"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "caps_lock pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "caps_lock pressed",
                "value": 1
              }
            }
          ],
          "to_after_key_up": [
            {
              "set_variable": {
                "name": "caps_lock pressed",
                "value": 0
              }
            }
          ]
        }
      ]
    }
  ]
}

4.启用自定义的配置

image.png
image.png image.png
上一篇下一篇

猜你喜欢

热点阅读