zed
zed copied to clipboard
VS code's terminal shortcuts not working properly
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
When I press Control + ` , the ternimal is opening fine, but upon pressing the same keys, it' not closing the terminal
Environment
Zed: v0.124.1 (Zed Preview) OS: macOS 14.2.1 Memory: 18 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
https://github.com/zed-industries/zed/assets/25414681/c9490c7a-8987-4105-80e5-49ad63f2c952
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
I don't think it's meant to close the terminal panel. The ctrl-~ keymap is mapped to the terminal_panel::ToggleFocus command, as opposed to "cmd-shift-h": "search::ToggleReplace", which e.g. toggles the replace search input.
@Moshyfawn but don't you think it should be toggling open and close, this is default behaviour in VSC.
To toggle the bottom dock on and off, there's this keymap:
[
{
"context": "Workspace",
"bindings": {
"cmd-j": "workspace::ToggleBottomDock"
}
}
]
Yep, This works as expected. It's just weird that with the keymap set to VSC, it's not the default behaviour.
Thanks @Moshyfawn
We do our best to match VS Code in the VS Code keymap - that being said, I'm not sure why we didn't match here. We have a few other cases of this as well. Ill leave the issue open and see if anyone else on the team has any opinions here.
This ctrl+` is terminal_panel::ToggleFocus, if changed to terminal_panel::ToggleDock, that will better, we can do with ctrl+` open or close the terminal dock.
In currently, we can use ctrl+` to do toggle show/hide if that is Zoom in mode.
So, can we do the same behavior for Zoom out mode?
Neither workspace::ToggleBottomDock, nor terminal_panel::ToggleFocus currently match the VS Code behavior that I'm used to.
In VS Code, pressing the key always first focuses the terminal if it's open, and only closes it when it's already in focus:
(I am unsure whether this can be configured, but I couldn't quickly find anything related to it in the Settings)
{
"key": "cmd+t",
"command": "workbench.action.terminal.toggleTerminal"
}
https://github.com/zed-industries/zed/assets/8061077/c45dac13-709a-4c29-b0ab-8329811d6aca
In Zed, focusing and toggling the panel are separate actions:
workspace::ToggleBottomDock
Toggles the panel, regardless of its focus state.
terminal_panel::ToggleFocus
Toggles focus of the panel, but never toggles the panel itself.
https://github.com/zed-industries/zed/assets/8061077/21cd6300-82e8-4c21-8d68-3c1721a0fed3
Coincidentally, after looking at 0.133.0's release notes, I figured out that there are context-specific bindings, which allow for re-creating this:
{
"context": "Terminal",
"bindings": {
"cmd-t": "workspace::ToggleBottomDock"
}
},
{
"context": "Editor",
"bindings": {
"cmd-t": "terminal_panel::ToggleFocus"
}
}
https://github.com/zed-industries/zed/assets/8061077/9631caeb-41cb-4ef3-bccb-cbe9bbbc9f00
It would be neat if Zed could replicate this with a command (terminal_panel::FocusToggle?), or include it as an example in the default keymap.
It would be neat if Zed could replicate this with a command (terminal_panel::FocusToggle?), or include it as an example in the default keymap.
This is a great idea. I'm including this in the template when I do:
- https://github.com/zed-industries/zed/issues/14248
Given that there's a workaround for emulating the vscode behavior I'm going to close this issue. Just put this in your ~/.config/zed/keymap.json. Thanks for sharing this out @xezrunner.
[
{
"context": "Terminal",
"bindings": {
"ctrl-`": "workspace::ToggleBottomDock" // match vscode behavior
}
}
]