Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在 gvim 中使用 key mapping 时输入法状态不能保存的问题 #24

Open
nemo-nullius opened this issue Oct 27, 2017 · 0 comments

Comments

@nemo-nullius
Copy link

nemo-nullius commented Oct 27, 2017

您好!

我最近发现在 gvim 中,设定并使用 key mapping 时,输入法的当前状态不能保存。就一般情况来说,比如从 insert mode 返回 normal mode 时,输入法会自动切为英文状态,以便输入命令;再从 normal mode 进入 insert mode 时,输入法又会自动切回之前切出时的状态。(如果切出之前在 insert mode 时是中文,再从 normal mode 切回 insert mode 时就会是中文状态;如果切出之前在 insert mode 时是英文状态,再从 normal mode 切回 insert mode 时就仍会保留英文状态。)

但是使用 key mapping 时就会出现一些奇怪的问题。比如设置这样一个 mapping:

:ino <C-X> <ESC>:startinsert<CR>

这时在 insert mode 中按 crtl+x,输入法并不会保留之前的状态,而保留的是之前状态再之前的状态。比如现在 insert mode 中输入法为中文状态(状态1),然后按 进入 normal mode,再按 i 进入 insert mode,这时输入法会保留为之前的状态1即中文状态。但是如果我这时又按下 Shift 键将输入法切为英文状态(状态2),再按下刚才设置的 key mapping ctrl+x,这时输入法又会自动切为状态1,而不是保留为状态2。之后,无论我将输入法切为何种状态,包括切为英文,切为繁体等,只要按下 ctrl+x,这些新状态都不会保留,而都会切换为最早按键盘 i 键进入 insert mode 时的状态1

但是,如果我不使用 key mapping,即如果我不按 ctrl+x,而是在键盘上逐个输入以上的命令,则不会有这一问题。比如现在 insert mode 中输入法为中文状态(状态1),然后按 <ESC> 进入 normal mode,再按 i 进入 insert mode,这时输入法会保留为之前的状态1即中文状态。我这时又按下 Shift 键将输入法切为英文状态(状态2),再按下 <ESC> 键,这时进入 normal mode 输入法自动切为英文,这时再输入:startinsert并按下<CR>键即回车进入 insert mode,这时输入法又会切回为状态2,而不像之前按下 ctrl-x 用 key mapping 执行这几条命令时切为状态1

我还试过其它一些输入法,多多输入法也有这一问题。但是, windows 10 自身带的输入法,小狼毫输入法,和极点输入法都无此问题。

由于自己常用的一些 vim 插件会涉及这一问题,用起来很不方便,所以很想知道到底是什么原因。非常感谢!

我的平台状况:

  • Windows 10
  • Gvim: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 12 2016 22:02:20)
    MS-Windows 64-bit GUI version 带 OLE 支持
  • PRIME 1.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant