Last active
February 19, 2020 02:10
-
-
Save rcmdnk/6147672 to your computer and use it in GitHub Desktop.
Automatic IME off for Vim by AutoHotkey. IME.ahk is needed to be placed in the same directory with this setting script (http://www6.atwiki.jp/eamat/pages/17.html).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Auto execute section is the region before any return/hotkey | |
; For Terminal/Vim | |
GroupAdd Terminal, ahk_class PuTTY | |
GroupAdd Terminal, ahk_class mintty ; cygwin | |
GroupAdd TerminalVim, ahk_group Terminal | |
GroupAdd TerminalVim, ahk_class Vim | |
; Include IME.hak | |
; http://www6.atwiki.jp/eamat/pages/17.html | |
#Include %A_ScriptDir%IME.ahk | |
Return | |
; ESC + IME | |
#IfWInActive, ahk_group TerminalVim | |
Esc:: ; Just send Esc at converting. | |
if (IME_GET(A)) { | |
if (IME_GetConverting(A)) { | |
Send,{Esc} | |
} else { | |
IME_SET() | |
} | |
} else { | |
Send,{Esc} | |
} | |
Return | |
^[:: ; Go to Normal mode (for vim) with IME off even at converting. | |
if (IME_GET(A)) { | |
Send,{Esc} | |
Sleep 1 ; wait 1 ms (Need to stop converting) | |
IME_SET() | |
Send,{Esc} | |
} else { | |
Send,{Esc} | |
} | |
Return | |
#IfWInActive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment