zed
zed copied to clipboard
Unable to use `cmd-0` to toggle dock visibility
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
First of all, great project, love the speed and looking forward to migrating from VSCode.
While moving some of my keymappings, I ran into an issue. I added the following to keymap.json so I could use cmd-0 to toggle dock visibility.
{
"context": "Editor",
"bindings": {
"cmd-0": "dock::FocusDock"
}
},
{
"context": "Dock",
"bindings": {
"cmd-0": "dock::HideDock"
}
}
With the above mapping, I'm able to open the dock with cmd-0, however, I'm not able to close it. I'm guessing once it's focused on dock, cmd-0 is being sent to the terminal directly and therefore not having an effect. I saw there's support for shift+esc in the default key mapping which toggles the dock visibility.
Would appreciate support for this if possible.
Environment
Zed: v0.77.3 (stable) OS: macOS 13.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
+1! I think an equivalent of
"cmd-b": "workspace::ToggleLeftSidebar"
but for toggling visibility of the dock is likely what we'd need, based on the existing keybinds 👍
Currently, we do have a command for toggling the dock, it is shift-esc, but not quite sure why we customizing it seems to be busted.
It actually works for me when using:
[
{
"context": "Workspace",
"bindings": {
"cmd-t": "dock::FocusDock"
}
},
{
"context": "Pane && docked",
"bindings": {
"cmd-t": "dock::HideDock"
}
}
]
I just didn't use Pane && docked before
Weirdly it doesn't work with cmd-0, but works with certain keys like: cmd-u etc.
I have the same issue but with the project_panel::ToggleFocus command.
I think the reason why it is not working is because the cmd-0 key binding is defined in the global keybindings
So it looks like the user key bindings with some context don't override the default key bindings.
Just in case, here is the keymap.json to reproduce this issue
[
{
"context": "Workspace",
"bindings": {
"cmd-0": "project_panel::ToggleFocus"
}
}
]
But this can be fixed by adding the command to the global bindings:
[
{
"bindings": {
"cmd-0": "project_panel::ToggleFocus"
}
}
]
I am not sure whether it would work with all key bindings, so a better solution would be to deregister a key binding (similar to VSCode), to ensure it is removed from the required context (in case there is one):
[
{
"bindings": {
"cmd-0": "-zed::ResetBufferFontSize" // notice the `-` before the command
}
},
{
"context": "Workspace",
"bindings": {
"cmd-0": "project_panel::ToggleFocus"
}
}
]