hirakiucの日記

いろいろ

karabiner-elements(12.0.0)でvim上でescapeを入力時に英数に戻す設定

すべては、[TerminalやMacVimでEsc (or ^)キーで日本語IMEを英数に切り替える.

設定

以下を~/.config/karabiner/assets/complex_modifications/escape_from_kana_on_vim.jsonに保存。

{
  "title": "Escape from kana on vim",
  "rules": [
    {
      "description": "Change eisu with escape on vim",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "escape",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "japanese_eisuu"
            },
            {
              "key_code": "escape"
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^com\\.apple\\.Terminal$",
                "^org\\.vim\\."
              ]
            }
          ]
        }
      ]
    }
  ]
}

その後、karabiner-elementsのpreferences -> Complex Modifications -> RulesたぶからAdd ruleよりEscape from kana on vim->Change eisu with escape on vimを追加。