MBP(はてな)

MacBook Pro,iPhone Xs,React

Karabiner-Elements Preferences

長年Linux/Windows使いだった私がmacOSで開発環境を整えるためにやったこと | DevelopersIO

$ cd ~/.config/karabiner/assets/complex_modifications
$ vi remap_cmd_tab.json

Karabiner-Elements Preferencesで、Complex Modificationsの、Add ruleをクリックすると、
追加した項目が表示される


動作確認のため、
Karabiner-Elements PreferencesのSimple Modificationsで、Add itemして、Letter keys a -> Letter keys bにして、
Quit, Restartを選択して、Restart Karabiner-Elementsすると、
Karabinerのキーボードの設定が表示された。
Terminalでキーボードのaを押すと、bが入力された。
なぜかCapsを押した時に、CapsがONになった(元々は、Capsにcommandを設定していた)
System Preferences - Keyboard - Modifier Keys...のSelect keyboardにKarabiner DriverKit VirtualHIDKeyboard 1.6.0が追加されていたので選択して、CapsをCommandに設定した。
Karabiner-Elements PreferencesのVirtual Keyboardを開くと、Country code:0にJIS (Japanese)が表示されていた。

試しに、fn + i を上矢印に設定して、viで動作確認できた。
Karabiner-Elementsの独自ルールの作成方法 – Webrandum

Enableを押したタイミングで反映されるので、
ファイルを編集した後は、一度削除してEnableを押す。

XcodeVim Modeでcontrol + l でescにするための設定(システム全体でcontrol + lがescになる)

control + l をescにすると、Terminalでcontrol + lした時にクリアされないので、
Xcodeの時だけ有効にするように設定
Karabinerを使ってXcodeのGo Forward/Go Backをマウスの第4/第5ボタンで実行できるようにする
Karabiner-Elementsで特定アプリの使用時のみキーバインドを変更する | 870 Laboratory

{
  "title": "xcode control+l maps to esc",
  "rules": [
    {
      "description": "Xcode only, control+l maps to esc",
      "manipulators": [
     {
       "conditions": [
          {
          "bundle_identifiers": ["^com\\.apple\\.dt.Xcode$"],
          "type": "frontmost_application_if"
          }
        ],
        "type": "basic",
        "from": {
            "key_code": "l",
            "modifiers": {
                "mandatory": [
                    "control"
                ],  
                "optional": [
                    "any"
                ]
            }
        },
        "to": [
               {
                "key_code": "escape"
               }            
        ]                   
      }                     
      ]         
    }           
  ]
}


既存のルールを参考にする
Karabiner-Elementsの独自ルールの作成方法 – Webrandum