zed icon indicating copy to clipboard operation
zed copied to clipboard

Allow removing/noop-ing entire Keymaps

Open LukasKnuth opened this issue 1 year ago • 1 comments

Check for existing issues

  • [X] Completed

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 very hard to navigate this config
  • Every update that adds new shortcuts will see them enabled by default
  • I can't simply "disable" a shortcut...

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!

  • [ ] Create a specific zed::NoOp action to disable existing bindings? Or have null work consistently.
  • [ ] Allow specifying that my bindings will disable all default bindings as well.

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

No response

LukasKnuth avatar Jan 30 '24 16:01 LukasKnuth

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.

mikayla-maki avatar Jan 31 '24 00:01 mikayla-maki

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.

ignatiusreza avatar Jul 16 '24 06:07 ignatiusreza