Keymaps that start with <space> cause delayed input in vim mode
Summary
When I set a keymap that binds space i h it causes delays in other actions that end in space such as df<space>.
Description
When binding things to space Zed seems to incorrectly interpret certain commands as a clash with it so it introduces the input delay e.g. with the settings from the below example if you enter df<space>ih it'll ignore the df and just trigger editor::ToggleInlayHints this is unlike the default behavior in vim which would be to recognize df<space> as a complete command, execute it and then continue ih.
Steps to reproduce:
- settings.json with
{ "vim_mode": true } - keymaps.json with:
{
"context": "Editor",
"bindings": {
"space i h": "editor::ToggleInlayHints"
}
}
- Enter
hello zedinto a file - Go to beginning of line with
<Esc>0 - Enter
df<space>, observe a delay before thehellois deleted - Comment out the binding, repeat 3-5
- Observe no delay
Expected Behavior: The command is processed with no delay even when the key is mapped. Actual Behavior: There is an observable delay
Zed Version and System Specs
Zed: v0.188.5 (Zed) OS: macOS 14.5.0 Memory: 24 GiB Architecture: aarch64
I use space-as-leader bindings a lot, but I use a more constrained context. EG:
{
"context": "Editor && !menu && VimControl && vim_mode == normal",
"bindings": {
"space *": "workspace::NewSearch",
"space b": "tab_switcher::ToggleAll"
}
If I use your exact binding, then ya - df<space> has a delay. If you instead modify it to constrain the context properly, there is no delay.
@bd-rulch that makes sense, thanks! Any docs on this? The basic contexts Editor, Workspace make sense to me but I had trouble finding more information about menu, vim_mode & VimControl in the zed docs
@Philogy I found these things through looking at the contents of the vim keymap (vim: open default keymap from the command palette) but it looks like it's all documented here. Looking at that, the context for my bindings can be simplified a bit - I hadn't looked into what VimControl actually mapped to.
been having the same issue for a whil
Hi there! 👋 We're working to clean up our issue tracker by closing older bugs that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and it will be kept open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, it will close automatically in 14 days. Thanks for your help!