zed icon indicating copy to clipboard operation
zed copied to clipboard

Keymaps that start with <space> cause delayed input in vim mode

Open Philogy opened this issue 6 months ago • 3 comments

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:

  1. settings.json with { "vim_mode": true }
  2. keymaps.json with:
  {
    "context": "Editor",
    "bindings": {
      "space i h": "editor::ToggleInlayHints"
    }
  }
  1. Enter hello zed into a file
  2. Go to beginning of line with <Esc>0
  3. Enter df<space>, observe a delay before the hello is deleted
  4. Comment out the binding, repeat 3-5
  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

Philogy avatar May 31 '25 16:05 Philogy

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 avatar Jun 02 '25 17:06 bd-rulch

@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 avatar Jun 02 '25 18:06 Philogy

@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.

bd-rulch avatar Jun 02 '25 19:06 bd-rulch

been having the same issue for a whil

soulsam480 avatar Jun 16 '25 08:06 soulsam480

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!

github-actions[bot] avatar Nov 19 '25 11:11 github-actions[bot]