jiangmiao/auto-pairs

IME Japanese input mode is turned off when a specific key is entered

yoshida-m-3 opened this issue · 5 comments

Entering the backspace or enter key turns off IME Japanese input.
The problem is limited to countries such as Asia that need to switch languages.

Is it possible to prevent IME Japanese input from being turned off due to unintended movement?

Also, disabling the plugin with <m-p> does not fix the problem.
Removing the plugin itself solves this, but I want to continue using this plugin.

Possibly related to #334

What key causes the conflict?

The two keys I'm seeing the problem with are backspace and enter.

You can see how the IME display at the bottom right switches without permission.
Display A when IME mode is OFF
When IME mode is ON, is displayed.

Video.mov

For good measure, can you let g:AutoPairsMapBS = 0 and check if Japanese mode still gets turned off when you press backspace? I don't understand what could cause this - auto-pairs shouldn't emit anything that leaves Vim. What keybind do you use to switch to and from Japanese mode?

Setting let g: AutoPairsMapBS = 0 no longer turns off the IME when pressing Backspace.

I'm sorry, and I noticed.
I have defined a command in autocmd to turn off IME on InsertLeave.
In the Japanese input environment, it is often customary to turn off the IME automatically.

Ahh, that explains it. <CR> directly uses escape. Not sure why backspace is triggered though, there's no escape involved there.

At worst, I can add a variable to keep track of "fake" normal mode (i.e. when normal mode is caused by the plugin temporarily). I've just found out about <C-c> though (https://vi.stackexchange.com/a/27196/21251), but that might not be recommended. I need to do some further research into this, but if I can find a way to exit insert mode in the mappings that doesn't trigger InsertLeave, I can fix this properly. Got no timeline on this though