feat: include the ModeChanged event for more flexibility#19
Open
koiking129 wants to merge 2 commits into
Open
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have been using this plugin for a while now, and enjoying the convenience of automatically switching IM, thanks for your work.
However, some specific needs cannot be met:
CmdlineLeaveis valuable, because we may search for some text in the command line. But, in most cases, we just want to execute some commands (e.g.:w), and only the default IM will be used. So, we may not expect the default IM to override the previous IM.CmdlineEnter(patterni:c) andCmdlineLeave(patternc:i) events will be triggered when I type theEnterkey in the insert mode, which may cause unexpected IM state switching ifCmdlineLeaveis included inset_default_events.Workaround:
The ModeChanged event supports the pattern match to identify events precisely:
i:n,R:n), which could be configured insave_state_patterns.i:c,c:i), which could be configured inexclude_patterns.这个插件非常棒,非常方便,感谢作者的积极维护。
用一段时间后,发现了一些问题:
CmdlineEnter(i:c模式)和CmdlineLeave(c:i模式)事件,如果在set_default_events中配置了CmdlineLeave就会自动切换为英文输入法。解决方案:
ModeChanged支持使用模式匹配来精确识别事件:
save_state_patterns里面配置exclude_patterns里面配置