LoginSignup
7
7

More than 5 years have passed since last update.

vim使用時の日本語入力を選択状態で、escapeキーもしくはcontrol+[の実行時に英数キーを同時に実行する - Karabiner(旧KeyRemap4MacBook)使用

Last updated at Posted at 2015-07-24

挿入モードから抜ける場合に日本語入力から英数へ同時に変更するためのKarabinerの設定ファイルの作成(iTerm2,MacVim,Terminalに対応)

/Users/usename/Application Support/Karabiner/private.xmlを下記に編集

<?xml version="1.0"?>
<root>
    <appdef>
        <appname>MacVIM</appname>
        <equal>org.vim.MacVim</equal>
    </appdef>
    <appdef>
        <appname>TERMINAL</appname>
        <equal>com.apple.Terminal</equal>
    </appdef>
    <appdef>
        <appname>ITERM2</appname>
        <equal>com.googlecode.iterm2</equal>
    </appdef>
    <windownamedef>
        <name>VIM</name>
        <regex>.* - VIM.*</regex>
    </windownamedef>
    <item>
        <name>Private Mapping</name>
        <item>
            <name>Custom Vim Change CONTROL_L+BRACKET_RIGHT+EISUU</name>
            <identifier>private.control_bracket_plus_eisuu</identifier>
            <only>MacVIM,TERMINAL,ITERM2</only>
            <windowname_only>VIM</windowname_only>
            <autogen>
                __KeyToKey__
                KeyCode::BRACKET_RIGHT, ModifierFlag::CONTROL_L,
                KeyCode::JIS_EISUU, KeyCode::BRACKET_RIGHT, ModifierFlag::CONTROL_L
            </autogen>
        </item>
        <item>
            <name>Custom Vim Change ESC+EISUU</name>
            <identifier>private.escape_plus_eisuu</identifier>
            <only>MacVIM,TERMINAL,ITERM2</only>
            <windowname_only>VIM</windowname_only>
            <autogen>
                __KeyToKey__
                KeyCode::ESCAPE,
                KeyCode::JIS_EISUU, KeyCode::ESCAPE
            </autogen>
        </item>
    </item>
</root>

Karabinerの環境設定画面 > Change Key 内の右上ReloadXMLを実行すると一番上にPrivateMappingが表示されます。

参考リンク
https://pqrs.org/osx/karabiner/index.html.en
https://pqrs.org/osx/karabiner/document.html#privatexml
https://pqrs.org/osx/karabiner/xml.html.en

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7