Cannot remap a sequence of 3 keys or more
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Describe the bug
My config has
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["<leader>", "z", "o"],
"after": [],
"commands": [
{
"command": "workbench.action.closeOtherEditors"
}
]
},
]
When I press space z o, the space z is first handled separately and does nothing, and then o is handled, which adds a new line. Instead I would like my newly-defined command to work.
My trace logs:
2025-03-19 14:36:50.783 [debug] Handling key: <space>
2025-03-19 14:36:50.783 [trace] trying to find matching remap. keys= . mode=Normal. keybindings=normalModeKeyBindingsMap.
2025-03-19 14:36:50.783 [trace] normalModeKeyBindingsMap. potential remap found. waiting for other key or timeout to finish.
2025-03-19 14:36:50.784 [trace] handleKeyEvent('<space>') took 1ms
2025-03-19 14:36:51.059 [debug] Handling key: z
2025-03-19 14:36:51.059 [trace] trying to find matching remap. keys= ,z. mode=Normal. keybindings=normalModeKeyBindingsMap.
2025-03-19 14:36:51.059 [trace] key= ,z. keySlice= z.
2025-03-19 14:36:51.059 [trace] normalModeKeyBindingsMap. potential remap broken. resending keys without allowing a potential remap on first key. keys= ,z
2025-03-19 14:36:51.060 [debug] Remapping to ,z
2025-03-19 14:36:51.060 [debug] Handling key: <space>
2025-03-19 14:36:51.060 [trace] trying to find matching remap. keys= . mode=Normal. keybindings=normalModeKeyBindingsMap.
2025-03-19 14:36:51.065 [trace] Setting key='vim.command' to value='<leader>'
2025-03-19 14:36:51.065 [trace] handleKeyEvent('<space>') took 6ms
2025-03-19 14:36:51.068 [debug] Handling key: z
2025-03-19 14:36:51.068 [trace] Setting key='vim.command' to value='<leader>z'
2025-03-19 14:36:51.068 [trace] Setting key='vim.command' to value=''
2025-03-19 14:36:51.068 [trace] handleKeyEvent('z') took 2ms
2025-03-19 14:36:51.069 [trace] handleKeyEvent('z') took 10ms
2025-03-19 14:36:51.344 [debug] Handling key: o
2025-03-19 14:36:51.345 [trace] trying to find matching remap. keys=o. mode=Normal. keybindings=normalModeKeyBindingsMap.
2025-03-19 14:36:51.346 [trace] Setting key='vim.command' to value='o'
Expected behavior
I would have expected my command space z o to apply the vscode command i defined in the remap.
- Extension (VsCodeVim) version: 1.29.0
- VSCode version: 1.85.2
- OS: MacPro M2
Additional context
I tried to instead setup keybindings in keybindings.json to do what I want. But it seems like if I define a keybinding there that starts with my vim <leader> key, the vscode-vim bindings stop working entirely.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files or tests are named. Reproduce the configuration and trace the normalModeKeyBindingsMap handling shown in the logs; done means a three-key mapping such as space z o reaches the configured VS Code command without handling the prefix separately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100