MacBookPro 键盘映射

    作为一个码农,带TouchBar的键盘只有虚拟ESC。只好映射一下,下边的`当ESC不错。同时把caps_lock映射成Ctrl。

那么ctrl+`改为`, shift+`改成~

1.安装karabiner。

2.设置karabiner属性里的simple modifications增加caps_lock to left_control

3.增加脚本

vim ~/.config/karabiner/assets/complex_modifications/1541404156.json

{
"title": "Change ctrl+` is `",
  "rules": [
 {
      "description": "Change grave accent and tilde to escape",
      "manipulators": [
        {
          "type": "basic",
          "from": {
              "key_code": "grave_accent_and_tilde"
          },
          "to": [
            {
              "key_code": "escape"
            }
          ]
        }
      ]
    },
   {
      "description": "change left_control + escape to accent`",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "grave_accent_and_tilde",
            "modifiers": {
                "mandatory":[
                        "left_control"
                ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde"
            }
          ]
        }
      ]
    },
{
      "description": "Change shift escape to grave accent and tilde",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "grave_accent_and_tilde",
                "mandatory":[
                        "left_shift"
                ],
"modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
                "mandatory":[
                        "left_shift"
                ]
            }
          ]
        }
      ]
    },
    {
      "description": "Change caps_lock to control if pressed with other keys, to escape if pressed alone.",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_control"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "escape"
            }
          ]
        }
      ]
    },
    {
      "description": "Change caps_lock to control if pressed with other keys. (rev 2)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_control"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "caps_lock",
              "hold_down_milliseconds": 500
            }
          ]
        }
      ]
    }
  ]
}

4.在Complex Modification中增加前三个。Over

你可能感兴趣的:(技术)