Vim
Vim copied to clipboard
Chinese input repeats characters when using VSCodeVim in insert mode
Description
When using Chinese input methods (including Baidu IME, Microsoft Pinyin, etc.) in VS Code with the VSCodeVim extension enabled, all Chinese characters and punctuation are entered twice in insert mode. This issue does not occur when the Vim extension is disabled.
Steps to Reproduce
- Enable the VSCodeVim extension
- Use any Chinese input method (e.g., Baidu IME, Microsoft Pinyin)
- Enter insert mode (
i) - Type any Chinese character or punctuation
Expected behavior: Characters should be entered normally, only once
Actual behavior: Each character is entered twice
System Info
- OS: Windows 11
- VS Code version: 1.101
- VSCodeVim version: 1.30.1
- IME: Baidu IME / Microsoft Pinyin
Additional Notes
This issue persists across different input methods and does not occur in other editors. Disabling the Vim extension fixes the issue.
I've tried:
- Disabling all other extensions ✔️
- Reinstalling input methods ✔️
- Using
vim.handleKeyssetting (partially helpful) ✔️ - Enabling Neovim mode (works but requires extra setup) ✔️
Would appreciate any insight or possible fixes. Thank you!
Sure thank u 👍
On Sat, 14 Jun 2025, 12:11 am 星幻丶碎梦, @.***> wrote:
SnowDream39 created an issue (VSCodeVim/Vim#9668) https://github.com/VSCodeVim/Vim/issues/9668 Description
When using Chinese input methods (including Baidu IME, Microsoft Pinyin, etc.) in VS Code with the VSCodeVim extension enabled, all Chinese characters and punctuation are entered twice in insert mode. This issue does not occur when the Vim extension is disabled. Steps to Reproduce
- Enable the VSCodeVim extension
- Use any Chinese input method (e.g., Baidu IME, Microsoft Pinyin)
- Enter insert mode (i)
- Type any Chinese character or punctuation
Expected behavior: Characters should be entered normally, only once Actual behavior: Each character is entered twice System Info
- OS: Windows 11
- VS Code version: 1.101
- VSCodeVim version: 1.30.1
- IME: Baidu IME / Microsoft Pinyin
Additional Notes
This issue persists across different input methods and does not occur in other editors. Disabling the Vim extension fixes the issue.
I've tried:
- Disabling all other extensions ✔️
- Reinstalling input methods ✔️
- Using vim.handleKeys setting (partially helpful) ✔️
- Enabling Neovim mode (works but requires extra setup) ✔️
Would appreciate any insight or possible fixes. Thank you!
— Reply to this email directly, view it on GitHub https://github.com/VSCodeVim/Vim/issues/9668, or unsubscribe https://github.com/notifications/unsubscribe-auth/BS6RJARUOIGPQFYJKE3VHAD3DLLZ5AVCNFSM6AAAAAB7IH2XWSVHI2DSMVQWIX3LMV43ASLTON2WKOZTGE2DGNZSGEZDQOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I have the same problem.
I have the same problem.
Same Problem.
Additional information: When using cursor (which is using VSCode Version 1.96.2 and VSCodeVim version 1.30.1), the problem does not appear. Maybe the bug is caused by the update of VSCode 1.101.
I also encountered this problem after updating to v1.101 today. In normal mode, if the input method is Chinese, no matter what you input, it will directly overwrite the characters under the cursor. Also, in insert mode, inputting Chinese punctuation such as commas and full stops will be repeated. Only after disabling the vim plug-in will this problem disappear.
版本: 1.101.0 (user setup) 提交: dfaf44141ea9deb3b4096f7cd6d24e00c147a4b1 日期: 2025-06-11T15:00:50.123Z Electron: 35.5.1 ElectronBuildId: 11727614 Chromium: 134.0.6998.205 Node.js: 22.15.1 V8: 13.4.114.21-electron.0 OS: Windows_NT x64 10.0.19045
Same issue on Windows after installing the latest VSCode update.
There are also similar issues on Mac, characters may be unexpectedly duplicated or deleted when using Chinese input methods.
For example, in visual mode selecting some characters, pressing 'y' followed by 'esc' with Chinese input method active will paste a segment of characters instead of simply canceling the input.
I have the same problem for version 1.101. no promblem for old version 1.99.3
try it, Toggling the setting editor.experimentalEditContextEnabled https://github.com/microsoft/vscode/issues/251518#issuecomment-2973606446
try it, Toggling the setting editor.experimentalEditContextEnabled microsoft/vscode#251518 (comment)
Thank you , It works. I'd like to provide more infomations for someone who still need help.
- open the settings
- enter
editor.experimentalEditContextEnabled - disable it
~~Hi VS Code developer here. This is a VS Code bug with a fix here: https://github.com/microsoft/vscode/pull/251826 which should make VIM work correctly when the setting editor.experimentalEditContextEnabled (soon to be editor.editContext) is turned on. Generally the editor.experimentalEditContextEnabled setting fixes certain IME bugs like the jittering of the text on input. Hopefully after the VIM issue is fixed, the setting can improve your IME experience within VS Code.~~
~~To the VIM authors, this PR essentially always calls the CompositionType handler during composition when using the EditContext API. Since the VIM extension does not override the CompositionType handler, that means that users will be able to do IME composition in the normal mode in Chinese and use English for the VIM commands. Hopefully this makes for a better IME experience as users will not need to change to insert mode to input Chinese.~~
Hopefully this makes for a better IME experience as users will not need to change to insert mode to input Chinese.
No, it's actually desirable to switch to insert mode in order to input Chinese.
Hi everyone, I have looked again at the issue and I noticed the following. When the EditContext is enabled and the Chinese Microsoft Pinyin IME is used, after typing a dot, we receive a textupdate event. We reset the EditContext state and this makes the Microsoft Pinyin IME send a second textupdate event, which is the reason a second dot is added. Generally you can see this happen on the following HTML example:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="html-editor" spellcheck="false" style="border:1px solid black"></div>
<script>
const IS_EDIT_CONTEXT_SUPPORTED = 'EditContext' in window;
console.log('IS_EDIT_CONTEXT_SUPPORTED : ', IS_EDIT_CONTEXT_SUPPORTED);
const editorEl = document.getElementById("html-editor");
editorEl.style.height = '200px';
editorEl.style.width = '100%';
if (IS_EDIT_CONTEXT_SUPPORTED) {
const editContext = new EditContext();
editorEl.editContext = editContext;
editContext.addEventListener("textupdate", e => {
console.log('textupdate : ', e);
editContext.text = '';
editContext.selectionStart = 0;
editContext.selectionEnd = 0;
});
}
</script>
</body>
</html>
If you type . while using the IME, it fires two text-update events. This looks like it could be a bug with the IME. I will discuss this with the team.
https://github.com/user-attachments/assets/8fe4415c-06e6-4184-9607-feaae9864826
try it, Toggling the setting editor.experimentalEditContextEnabled microsoft/vscode#251518 (comment)
Thank you , It works. I'd like to provide more infomations for someone who still need help.
- open the settings
- enter
editor.experimentalEditContextEnabled- disable it
It works.
see Edit Context
open setings editor.experimentalEditContextEnabled
or editor setings.json editor.experimentalEditContextEnabled to false fix this
{
"editor.experimentalEditContextEnabled": false
}
pass test at
- VSCode version: 1.101.2
- Extension (VsCodeVim) version: 1.30.1
OS: Microsoft Windows 11
10.0.26100
10.0.22621
I have recently pushed a fix which should fix this even when the setting is enabled. Should work on insiders now.
Seems like it’s been fixed in VSCode 1.102.0.
Seems like it’s been fixed in VSCode 1.102.0.
No, vscode 1.102.1 on osx still have this problem.
Hi @wvq thanks for letting me know. Could you file an issue showing how to reproduce this issue on the VS Code repo with a screen recording?
Hi @aiday-mar, In my case only the first input character is repeated once, and the repeated character is executed as vim command.
vscode 1.102.1 vscodevim.vim 1.30.1
https://github.com/user-attachments/assets/ad13d0b9-f66e-4bda-813d-7a623cb15f04
I'm using chinese Wubi IME, input vkjs = 如果,
expect is test 如果input, acture is test v如果nput, first letter v is executed as vim command.
expect is
test 如果input, acture istest v如果nput, first lettervis executed as vim command.
No, the letter v was simply inserted into the text, and the letter i was replaced when you typed the second k. This behavior is quite strange.
Also, this bug seems to occur only when typing Chinese characters immediately after entering insert mode in VIM.
@llleixx you are right.
After more testing, switch to insert mode by i has this bug, other commands is OK, like a or o.
If I change the cursor to other position and set it back, everything is OK.
@RegisterAction
export class CommandInsertAtCursor extends BaseCommand {
modes = [Mode.Normal];
keys = [['i'], ['<Insert>']];
public override async exec(position: Position, vimState: VimState): Promise<void> {
await vimState.setCurrentMode(Mode.Insert);
// test code:
const editor = vscode.window.activeTextEditor
if(editor) {
// set cursor to somewhere else
editor.selection = new vscode.Selection(position.getLeft(), position.getLeft())
setTimeout(() => {
// set cursor back
editor.selection = new vscode.Selection(position, position)
}, 0)
}
// end test code
}
// ...
}
But I can't find any difference of activeTextEditor state.
Hi wvq thanks for the comment. Could you file the issue here: https://github.com/microsoft/vscode/issues
@aiday-mar I don't understand. This doesn't seem like a VSCode's bug.
@puck1006 -_- 这个issue本来就有解决方案了嘛,只是没处理掉这个bug
@aiday-mar https://github.com/microsoft/vscode/issues/261797 Tracked here.
Fixed by https://github.com/microsoft/vscode/issues/261797.
I am in vscode version v1.104, the editor.experimentalEditContextEnabled has became editor.EditContext.
I enabled it and found not issue now.
See if this issue can be closed. If so, I can link all the same issue this the solution and close all of them.