zed icon indicating copy to clipboard operation
zed copied to clipboard

Vim mode: using "space" as a leader key sometimes doesn't activate

Open SamHep0803 opened this issue 1 year ago • 6 comments
trafficstars

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

From time to time, if a custom keybinding uses space as a "leader key", the default behaviour will still occur, meaning that the custom keybinding will not fire correctly. For example, if the binding is "space o t" in order to focus the terminal panel, sometimes the default binding for space (which moves the cursor to the right by one character) is triggered, meaning that the other keys pressed (o and t) are fired as normal, which will create a new line and insert the letter t.

Environment

Zed: v0.121.1 (Zed Preview) OS: macOS 14.0.0 Memory: 16 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

SamHep0803 avatar Feb 02 '24 07:02 SamHep0803

We do have a timeout of 1sec in which you need to hit the following keys. Do you think you might run into this? Or do you have any other steps to reproduce?

mrnugget avatar Feb 02 '24 07:02 mrnugget

That's the thing, there is no 1sec timeout because it immediately just uses the default binding. I'll get a quick screencap of this.

SamHep0803 avatar Feb 02 '24 07:02 SamHep0803

https://github.com/zed-industries/zed/assets/14109339/355f9373-bbe1-43ad-918a-3b4753165c78

Here I'm using the "space o t" keybind I referred to in my original comment.

SamHep0803 avatar Feb 02 '24 07:02 SamHep0803

For me it seems to works perfectly on that pre-release: https://github.com/zed-industries/zed/releases/tag/v0.121.1-pre

Here is an example of my keymap: (I even test it too with space o t and it was working fine for me)

[
  {
    "context": "Editor && vim_mode == normal && vim_operator == none && !VimWaiting",
    "bindings": {
      "space e": "workspace::ToggleLeftDock",
      "space t": "workspace::ToggleBottomDock",
      "space /": [
        "editor::ToggleComments",
        {
          "advance_downwards": false
        }
      ]
    }
  },
  {
    "context": "ProjectPanel",
    "bindings": {
      "escape": "workspace::ToggleLeftDock"
    }
  },
  {
    "context": "Terminal",
    "bindings": {
      "cmd-n": "workspace::NewTerminal",
      "cmd-d": "pane::CloseActiveItem",
      "cmd-t": "workspace::ToggleBottomDock",
      "cmd-shift-f": "workspace::ToggleZoom",
      "escape": "workspace::ToggleBottomDock"
    }
  }
]

Edit: It may always works for me because I always close my Panel/Terminal with escape to return the focus on my editor?

t1gu1 avatar Feb 02 '24 19:02 t1gu1

Not quite sure then, bare in mind this isn't just an issue with the space o t keybind, for me this is happening regardless of the letters after space is hit.

SamHep0803 avatar Feb 02 '24 21:02 SamHep0803

Apologies, thought this was fixed after a reboot, but no such luck.

SamHep0803 avatar Feb 02 '24 21:02 SamHep0803