Description
When overriding the built-in c mapping using vim.normalModeKeyBindingsNonRecursive, the custom mapping only works while the key sequence is entered within timeoutlen.
After timeoutlen expires, pressing c still triggers the built-in Quit action (c) and closes the editor, even though the built-in mapping has been overridden.
Steps to Reproduce
Configuration:
{
"vim.timeout": 3000,
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["<C-w>", "c"],
"commands": [
"workbench.action.showCommands"
]
}
]
}
- Open a file.
- Press Ctrl+w.
- Wait less than timeoutlen.
- Press c.
Result: The Command Palette opens (workbench.action.showCommands).
- Press Ctrl+w.
- Wait longer than timeoutlen.
- Press c.
Result: The active editor is closed via the built-in c Quit action.
Expected Behavior
Once a built-in mapping has been overridden, the original action should never be executed.
After timeoutlen expires, one of the following would be expected:
The custom mapping still resolves.
The pending sequence is discarded.
The sequence is treated as unresolved and does nothing.
What should not happen is falling back to the original built-in c action that has already been overridden by a user mapping.
Additional Information
The behavior suggests that custom mappings and built-in actions are resolved through separate paths:
While the mapping timeout is active, the custom mapping takes precedence.
After the timeout expires, the built-in action becomes active again.
This effectively causes the original c binding to be restored after timeoutlen, which is surprising and makes overriding built-in commands unreliable.
I was able to trace the built-in action to the following registration:
keys = [
['<C-w>', 'q'],
['<C-w>', '<C-q>'],
['<C-w>', 'c'],
['<C-w>', '<C-c>'],
];
The custom mapping successfully overrides this action before timeout expiry, but not afterwards.
- Extension (VsCodeVim) version: v1.32.4
- VSCode version: 1.124.2
- OS: Window 11 Home
Description
When overriding the built-in c mapping using vim.normalModeKeyBindingsNonRecursive, the custom mapping only works while the key sequence is entered within timeoutlen.
After timeoutlen expires, pressing c still triggers the built-in Quit action (c) and closes the editor, even though the built-in mapping has been overridden.
Steps to Reproduce
Configuration:
Result: The Command Palette opens (workbench.action.showCommands).
Result: The active editor is closed via the built-in c Quit action.
Expected Behavior
Once a built-in mapping has been overridden, the original action should never be executed.
After timeoutlen expires, one of the following would be expected:
The custom mapping still resolves.
The pending sequence is discarded.
The sequence is treated as unresolved and does nothing.
What should not happen is falling back to the original built-in c action that has already been overridden by a user mapping.
Additional Information
The behavior suggests that custom mappings and built-in actions are resolved through separate paths:
While the mapping timeout is active, the custom mapping takes precedence.
After the timeout expires, the built-in action becomes active again.
This effectively causes the original c binding to be restored after timeoutlen, which is surprising and makes overriding built-in commands unreliable.
I was able to trace the built-in action to the following registration:
The custom mapping successfully overrides this action before timeout expiry, but not afterwards.