Question: How to control IME in vim mode?

I like Inkdrop’s vim mode.
I’m a light vimmer, so it’s just as well that I can operate in insert mode as I would in a typical Windows editor.

By the way, in the Inkdrop vim plugin, is there any way to turn off the IME as well with ESC or Ctrl + [ when in non-normal mode? I’ve tried assigning shortcuts on the IME side, but the keystrokes don’t seem to propagate to Inkdrop.

I don’t have the skills to make a plugin yet, so it would be nice if it could be done with init.js or a simple customization.

Hi Avis,

Thank you for the question.
I had brief research on IME but it turns out that Electron does not provide any API for controlling IME, unfortunately.

Thank you for your support !
I understand.

I finally solved it with AutoHotKey.

As a prerequisite, I use ATOK for IME, but you can probably do the same thing with MS IME.

I have assigned IME OFF to “ESC” and “Ctrl + [” in ATOK, and whether IME is ON or OFF, if I can send those keys for two strokes, I can go back to normal mode.

Therefore, I used a small ahk script as follows.

#SingleInstance, Force

if WinActive("ahk_exe Inkdrop.exe")
    || WinActive("ahk_exe Code.exe")
    $^[::Send ^{[ 2}
    $ESC::Send {ESC 2}

This only works if Inkdrop and VSCode are active.

For your reference.

1 Like

Cool solution! Thanks for letting me know :smiley: