Saturday, April 22, 2017

【MacOSX, Karabiner】Terminal, iTerm2, MacVimで、「左commandキー」を押して離しきった時だけ、「Escapeキー」に変更


【MacOSX, Karabiner】Terminal, iTerm2, MacVimで、「左commandキー」を押して離しきった時だけ、「Escapeキー」に変更

具体的には、Karabiner の private.xml を以下のように記述した。

<参考にしたページ>
Karabinerのpravate.xmlの記述方法!さらに深いキーリマップ方法、マクロ も組める!

 

<?xml version="1.0"?>
<root>
  <appdef>
    <appname>MacVim</appname>
    <equal>org.vim.MacVim</equal>
  </appdef>
  <list>
    <item>
      <name>Change Command_L to Escape(Macvim)</name>
      <identifier>private.app_MacVim_esc_with_COMMAND_L</identifier>
      <only>MacVim</only>
      <autogen>--KeyOverlaidModifier-- KeyCode::COMMAND_L, KeyCode::COMMAND_L, KeyCode::ESCAPE</autogen>
    </item>
  </list>
</root> 

<root>
  <appdef>
    <appname>Terminal</appname>
    <equal>terminal</equal>
  </appdef>
  <list>
    <item>
      <name>Change Command_L to Escape(Terminal)</name>
      <identifier>private.app_terminal_esc_with_COMMAND_L</identifier>
      <only>TERMINAL</only>
      <autogen>--KeyOverlaidModifier-- KeyCode::COMMAND_L, KeyCode::COMMAND_L, KeyCode::ESCAPE</autogen>
    </item>
  </list>
</root>

<root>
  <list>
    <item>
      <name>LeaveInsMode with EISUU(Terminal)</name>
      <identifier>private.app_terminal_esc_with_eisuu</identifier>
      <only>TERMINAL</only>
      <autogen>--KeyToKey-- KeyCode::ESCAPE, KeyCode::ESCAPE, KeyCode::JIS_EISUU</autogen>
      <autogen>--KeyToKey-- KeyCode::BRACKET_LEFT, VK_CONTROL, KeyCode::BRACKET_LEFT, VK_CONTROL, KeyCode::JIS_EISUU</autogen>
      <autogen>--KeyToKey-- KeyCode::C, VK_CONTROL, KeyCode::C, VK_CONTROL, KeyCode::JIS_EISUU</autogen>
    </item>
  </list>
<root>