Vim: Disable Input Method when exiting Insert Mode

Created on 18 Oct 2016  ·  20Comments  ·  Source: VSCodeVim/Vim


Please _thumbs-up_ 👍 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.


What did you do?

Typing in Chinese in 'Insert Mode' with system Input Method in Mac OSX then exit 'Insert Mode' with 'ESC' key.

What did you expect to happen?

In MacVim, the Chinese Input Method will be disabled (switched to English mode) or if ':set noimdisable' is used, the Input Method will be switched to 'U.S English' or whatever default Input Method is set in the system. This is to ensure once one exit the Insert Mode, Normal Mode commands can be used immediately without the Input Method intercepting the keystrokes.

What happened instead?

In VS Code with Vim mode plugin, the editor would just exit to Normal Mode without switching off the Input Method, and one would need to manually disable the Input Method to be able to execute commands such as 'h, j, k, l'

Technical details:

  • VSCode Version: 1.6.1
  • VsCodeVim Version: 0.3.7
  • OS: Mac OSX El Captain 10.11.6
help wanted kinfeature sizM

Most helpful comment

Sharing what I'm doing now in vim-mode-plus.
If result goes well, maybe VSCodeVim can use same approach.

https://github.com/t9md/atom-vim-mode-plus/pull/1040

All 20 comments

It's the same behavior as vanilla Vim. But basically I like this idea.

Thank you! It would be very helpful. I'll try to work out a way to implement this function in the meantime.

@kwopera go ahead! This feature includes two pieces of code change, this first one is adding a config at https://github.com/VSCodeVim/Vim/blob/master/src/configuration/configuration.ts#L52 and the second is switching IME when Vim switches mode https://github.com/VSCodeVim/Vim/blob/master/src/mode/modeHandler.ts#L753 .

Great! Thank you so much for your help!! :)

@kwopera @rebornix any progress on this issue?

@rebornix when vim compiled whit +multi_byte_ime, it will have the behaviour
see http://vimhelp.appspot.com/mbyte.txt.html#multibyte-ime
Missing this feature too

any progress on this issue? very expecting on this feature.

@rebornix This feature is provided by plugin fcitx.vim, on macOS using https://github.com/CodeFalling/fcitx-remote-for-osx

Hope this helps:smile:

Hi, I found some dirty hacks at t9md/atom-vim-mode-plus#148, thus we are all based on electron, this method may also be used in vscode.

@heyeshuang That patch's author here, the approach is discarded by atom-vim-mode-plus's author for some side effect. I dont know wether it can be used here.

Is there any update?

Hi guys, for atom again there is an extension named atom-vim-mode-plus-auto-ime, which can run a command when the mode changes. I think we can also control input method in that way.

中文党前来支援一波

chrome 有个插件叫Vimium 这个插件里ime是自动切换的,不知道是不是对你有帮助

so is there update?

This extension can be used to work around this issue:

SwitchIm: https://marketplace.visualstudio.com/items?itemName=zhouyixiang.switchim

However, it cannot "remember" input method for Input Mode.

Sharing what I'm doing now in vim-mode-plus.
If result goes well, maybe VSCodeVim can use same approach.

https://github.com/t9md/atom-vim-mode-plus/pull/1040

so is there update?

I think it is not easy to do this, But could the author add a configuration that user could run a command to change the input method as follow:

command_to_run_after_switch_to_command_mode: c:\custom_exe_to_switch_my_input_method
command_to_run_after_switch_to_insert_mode: c:\custom_exe_to_switch_my_input_method

I think this is much easier to implement.

Fixed with PR #2643

Does the fix work on windows?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ACollectionOfAtoms picture ACollectionOfAtoms  ·  3Comments

gerardmrk picture gerardmrk  ·  3Comments

spinningarrow picture spinningarrow  ·  3Comments

rajinder-yadav picture rajinder-yadav  ·  3Comments

triztian picture triztian  ·  3Comments