Unyablog.

のにれんのブログ

iTerm2 JISキーボード 文字 拡大 Karabiner-Elements

iTerm2 で文字を拡大するショートカットは ⌘ + である。

JISキーボードでは +Shift ; を入力することになるので、⌘ + は JIS では Shift ⌘ ; が入力される。

一方 iTerm2 では、Shift ⌘ ; が Open Command History に割り当てられている。このため、JISキーボードで文字を拡大しようとすると謎の機能が発火してしまう。

これの対策として、

  • iTerm2 を表示している
  • JISキーボードである

場合、Karabiner-ElementsShift ⌘ ;⌘ + に変換するようにする。

{
  "title": "Send Cmd+'+' on iTerm2",
  "rules": [
    {
      "description": "Send Cmd+'+' on iTerm2",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "semicolon",
            "modifiers": {
              "mandatory": [
                "command", "shift"
              ]
            }
          },
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.googlecode.iterm2"
              ]
            },
            {
              "type": "keyboard_type_if",
              "keyboard_types": [
                "jis"
              ]
            }
          ],
          "to": [
            {
              "key_code": "keypad_plus",
              "modifiers": [
                "left_command"
              ]
            }
          ]
        }
      ]
    }
  ]
}