zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
45.73k stars 2.52k forks source link

Easier way to remove ctrl-w delay with vim mode #13315

Open iluuu1994 opened 2 months ago

iluuu1994 commented 2 months ago

Check for existing issues

Describe the feature

Vim-mode in zed declares a plethora of keymaps starting with ctrl-w. I personally don't use any of them, and just use ctrl-w to close the current tab, but want to remove the annoying 1s delay. However, getting this behavior is not quite straight-forward. I needed to add the following keymap:

Details

```json [ { "context": "Editor", "bindings": { "ctrl-w left": null, "ctrl-w right": null, "ctrl-w up": null, "ctrl-w down": null, "ctrl-w h": null, "ctrl-w l": null, "ctrl-w k": null, "ctrl-w j": null, "ctrl-w ctrl-h": null, "ctrl-w ctrl-l": null, "ctrl-w ctrl-k": null, "ctrl-w ctrl-j": null, "ctrl-w shift-left": null, "ctrl-w shift-right": null, "ctrl-w shift-up": null, "ctrl-w shift-down": null, "ctrl-w shift-h": null, "ctrl-w shift-l": null, "ctrl-w shift-k": null, "ctrl-w shift-j": null, "ctrl-w g t": null, "ctrl-w ctrl-g t": null, "ctrl-w g shift-t": null, "ctrl-w ctrl-g shift-t": null, "ctrl-w w": null, "ctrl-w ctrl-w": null, "ctrl-w p": null, "ctrl-w ctrl-p": null, "ctrl-w shift-w": null, "ctrl-w ctrl-shift-w": null, "ctrl-w v": null, "ctrl-w ctrl-v": null, "ctrl-w s": null, "ctrl-w shift-s": null, "ctrl-w ctrl-s": null, "ctrl-w c": null, "ctrl-w ctrl-c": null, "ctrl-w q": null, "ctrl-w ctrl-q": null, "ctrl-w o": null, "ctrl-w ctrl-o": null, "ctrl-w n": null, "ctrl-w ctrl-n": null, "ctrl-w d": null, "ctrl-w g d": null, "ctrl-w shift-d": null, "ctrl-w g shift-d": null, "ctrl-w space": null, "ctrl-w g space": null } } ] ```

It's also fragile, because any new shortcut added to zed in the future will re-add the delay. It would be great if there was a better way to achieve this, e.g. through a wildcard of some kind:

[
  {
    "context": "Editor",
    "bindings": {
      "ctrl-w *": null,
  }
]

If you don't think this needs better support, feel free to close this issue.

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

No response

sibouras commented 2 months ago

+1, i use ctrl-j/k in vim mode to scroll and i had to unbind all the ctrl-k keymaps

xzbdmw commented 2 months ago

+1, i use ctrl-j/k in vim mode to scroll and i had to unbind all the ctrl-k keymaps

You can try karabiner to map c-k to something else in zed to avoid unmapping all of them c-w can treated the same, eg. map c-w to f12 in karabiner level and map f12 to close tab in zed level

sibouras commented 2 months ago

@xzbdmw good solution thanks

0x2CA commented 1 month ago

If nowait is implemented it can do immediate processing for <c-w> https://github.com/zed-industries/zed/issues/12539#issuecomment-2230183940

xzbdmw commented 1 month ago

Hmm, doesn’t nowait only applys to buffer local keymaps

iluuu1994 commented 2 weeks ago

It seems my workaround broke. I can't remove the delay now. :slightly_frowning_face: