Closed jxlpzqc closed 1 year ago
There are at least 3 pr or issue about this feature, and the contributers have different opinions about it.
I will add an option to let you change the behavior as you like.
Thank you!
Could you please test if this PR works well with you: https://github.com/keaising/im-select.nvim/pull/15
@jxlpzqc
Thanks, I have tested this patch, and it works, but a obvious latency (at least 100ms) could be seen when I change mode.
First, wait job to finish seems to block neovim main thread. Second, even if not block, the speed of ime changing remains slow. probably the performance cost come from fork of new process, ime-select.exe.
I wonder whether there is an approach to address this issue?
Besides, after several times of mode change, the state saved appears to be inconsident, i.e. It cannot change to Microsoft Pinyin automatically again.
Maybe some mutex locks are supposed to be added to keep it in consisdent state?
Btw, I found you are living in Beijing in your profile. It may be better if the disscussion could be in Chinese, if you, and other contributers will.
@keaising
我在 WSL 上使用时也有类似的延迟,但是在 Linux 和 macOS 上都没问题
我倾向于延迟来自于 im-select.exe
,因为直接调用 im-select.exe
也有点卡
但是我也没有找到合适的替代品可以用来切换输入法,你如果有合适的话可以告诉我
我又测试了一下使用 im-select.exe
切换到微软英语键盘、微软德语键盘和中文输入法时的延迟很小,但是切换到搜狗输入法时延迟很大,至少100ms,看起来跟输入法本身也有些关系,有空我再用 AHK 试试,不过我感觉能修复的可能性不太大了
我用 AHK 脚本也试了一遍,我能找到的 AHK 脚本在切换输入法的时候也会卡一下(主要是搜狗,微软自带的输入法都还好)
暂时就先这样吧,提供了一个开关 async_switch_im
,默认情况下会异步执行切换,有需要可以改为同步: https://github.com/keaising/im-select.nvim/pull/15/commits/a48e3c28a3280220a88d02b04fdcf7ed63b17e73
另外我不打算添加确保数据一致性的代码,尝试了一下发现代码量有点大,而且感觉意义不大,发现没有切换的话再手动摁一下就行,而且一般出来没有切换多半是输入法的延迟,这个很难从插件层面解决,不太好兼容
For future users:
I have tried to use AHK scripts to switch input method, there are also an obvious lag when switching in Windows.
I provide a new option async_switch_im
for users to determine how to switch input method: async or sync, default value is true
to keep same behavior as before, you can find it in commit: https://github.com/keaising/im-select.nvim/pull/15/commits/a48e3c28a3280220a88d02b04fdcf7ed63b17e73
同样感谢你提的这个 PR,虽然没有合并,但是你的想法激发了开关 async_switch_im
的诞生,这个开关已经在 master 分支了,有需要的话可以使用
有一个梗说“vim用户需要两个脚踏板,一个按esc键,一个是切换输入法”。
vi模式下的IME输入一直是一个痛点,非常感谢作者积极维护这个插件,让这种编辑模式设计上固有的缺陷变得越来越无足轻重。
When
detach
, ajobstart
opts, is set true, some strange things happens. The jobstart function could not start new process properly.Although this issue is probably caused by neovim bugs, removing the
detach
option just works.My environment:
release-1.3/neovim-0.9-d1c1bac