Cannot unbind commands used in native menus on macOS
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
Can not unbind a command by setting it to null.
- Paste the following setting in keymap.json
[
{
"context": "Editor && mode == full",
"bindings": {
"ctrl-g": null
}
}
]
- Press
ctrl-g.
Environment
Zed: v0.122.1 (Zed Preview) OS: macOS 14.2.1 Memory: 32 GiB Architecture: x86_64
If applicable, add mockups / screenshots to help explain present your vision of the feature
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
Thanks for reporting this!
It looks like this is broken specifically in the case that the action is in the menu; because macOS triggers the key-binding for us.
This should be fixable, and if you'd like to pair on a fix, please book time here: https://calendly.com/conradirwin/pairing
Can I help if I am not experienced in Rust?
Absolutely! I think the problem stems from how our keybindings interact with the macOS key handler; so mostly this is going to be reading documentation and trying to figure out what to do. Happy to pair on it if you want: https://calendly.com/conradirwin/pairing
Not sure if it's related. I trying to rebind cmd-a in the search bar
{
"context": "BufferSearchBar",
"bindings": {
"cmd-a": "search::SelectAllMatches"
}
}
But with the above config, cmd-a still "selects all the text in the input text field" instead of "selecting all the matches".
Updated:
Also
{
"context": "Pane",
"bindings": {
"cmd-c": "search::ToggleCaseSensitive"
}
}
does not work maybe due to "cmd-c" is some global key bindings for copy.
Yup, it looks like this is also in the "Selection" menu.
@meguriau Coming from Emacs too, find a temp fix for the specific ctrl-g issue using the recent send keystrokes feature
{
"context": "Editor",
"bindings": {
"ctrl-g": ["workspace::SendKeystrokes", "escape"],
...
}
}
With this config, at least the annoying go to line box will not be shown up.