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
46.58k stars 2.64k forks source link

Allow removing/noop-ing entire Keymaps #7089

Open LukasKnuth opened 7 months ago

LukasKnuth commented 7 months ago

Check for existing issues

Describe the feature

My Use-case

I'd like to fully disable all key bindings that the editor has (basically have no keyboard shortcuts at all). Then, very selectively go and set up bindings for specific actions that I actually use. The difference to how bindings work right now is that currently they're additive (overriding on conflict) where my use case is replacing the entire config (disabling any bindings that aren't mentioned in my config).

Current Options

Theoretically I could simply copy the entire "Default Key Bindings" and disable what I don't want. This has some issues:

It's not really possible to deactivate an existing shortcut at the moment. https://github.com/zed-industries/zed/issues/6422 seems to imply that simply mapping to null will disable the binding. This does not work for cmd-q for example (Editor still closes). The alternative mentioned in https://github.com/zed-industries/zed/issues/5887 seems to be binding the key to an action that doesn't do much in the specific context. This is very situational and not explicit.

Ideas for implementation

Perhaps it would be possible to implement some of these step by step to help get us there in smaller increments? This doesn't have to be all-or-nothing!

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

No response

mikayla-maki commented 7 months ago

yeah, we need to make our keymap system a little more flexible, I think this feature + https://github.com/zed-industries/zed/discussions/6763 can be incorporated together.

ignatiusreza commented 1 month ago

Adding to this, I've f12 mapped to open the Guake terminal in quake mode. This works everywhere else outside of zed, but it doesn't work when zed is in focus.

I tried to add the following custom keymap, but it doesn't work.

[
  {
    "context": "Editor",
    "bindings": {
      "f12": null
    }
  }
]

What's funny also, is that I found that f12 is mapped to editor::GoToDefinition in the default Bindings from VS Code. I'm setting "base_keymap": "Atom", so I'm also not sure why default binding from VS Code are still applied.