The Cmd-W (or Ctrl-W) keyboard shortcut should close only the editor, not the left dock #41122
Replies: 15 comments 6 replies
-
|
The amount of times I've closed my left dock because of this. Tried changing settings, but can't seem to make |
Beta Was this translation helpful? Give feedback.
-
|
Hope it's OK to add a "me too". I keep clicking a file in the left dock to take a peek at it, then I hit CMD-W intending to close it, but because I never clicked in the editor pane, my left dock closes instead. Infuriating! |
Beta Was this translation helpful? Give feedback.
-
|
Agree |
Beta Was this translation helpful? Give feedback.
-
|
This breaks my workflow so often. AFAICT, it's not possible to fix in the key map since editor tabs and docks are both considered "panes" and there is no action for specifically closing editor tabs, only the active pane. |
Beta Was this translation helpful? Give feedback.
-
|
Me too, one of the things that I still can't switch fully to Zed. |
Beta Was this translation helpful? Give feedback.
-
|
It took me a second to realise this is a discussion, not a ticket / issue. It needs to be a raised issue, it's one of the key issues stopping me from switching from VS Code. It's fundamental UX. I did a couple of searches of issues but nothing popped up.... EDIT: #34865 |
Beta Was this translation helpful? Give feedback.
-
|
I also find this extremely frustrating. This keymap worked for me (from comments on #34865): {
"context": "ProjectPanel",
"bindings": {
"ctrl-w": ["workspace::SendKeystrokes", "ctrl-k ctrl-right ctrl-w"]
}
}This sends "workspace: activate pane right, pane: close active item" when the project panel receives ctrl-w |
Beta Was this translation helpful? Give feedback.
-
|
Another option is to disable all CMD+W keybinds, except in the {
"context": "Editor",
"bindings": {
"cmd-w": [
"pane::CloseActiveItem",
{
"close_pinned": false
}
]
}
},
{
"context": "Pane",
"unbind": {
"cmd-w": [
"pane::CloseActiveItem",
{
"close_pinned": false
}
]
}
},
{
"context": "RulesLibrary",
"unbind": {
"cmd-w": "workspace::CloseWindow"
}
},
{
"context": "Workspace",
"unbind": {
"cmd-w": "workspace::CloseActiveDock"
}
} |
Beta Was this translation helpful? Give feedback.
-
|
This should be fixed. |
Beta Was this translation helpful? Give feedback.
-
|
@jonas-jonas - your config did not work for me, still closing side panels on // Zed keymap
// https://zed.dev/docs/key-bindings
// default key bindings: `zed: open default keymap`
//
[
{
"context": "AgentPanel||ProjectPanel",
"bindings": {
"ctrl-w": ["workspace::SendKeystrokes", "ctrl-k ctrl-right ctrl-w"]
}
},
{
"context": "GitPanel||OutlinePanel||CollabPanel",
"bindings": {
"ctrl-w": ["workspace::SendKeystrokes", "ctrl-k ctrl-left ctrl-w"]
}
}
] |
Beta Was this translation helpful? Give feedback.
-
|
By default {
"context": "Pane",
"bindings": {
"cmd-w": ["pane::CloseActiveItem", { "close_pinned": false }],
}
},
{
"context": "Workspace",
"bindings": {
"cmd-w": "workspace::CloseActiveDock",
}
}This means that when you are focused on a if you change the {
"context": "Workspace",
"bindings": {
"cmd-w": "pane::CloseActiveItem",
}
}if this does not work for you then try setting the keybinding at the global level {
"bindings": {
"cmd-w": "pane::CloseActiveItem",
}
} |
Beta Was this translation helpful? Give feedback.
-
|
@dcog989 can you set just the sendKeystrokes is a bit fragile because the current implementation here will break if you change which side the dock is on or if you change what bindings move focus to the panes, etc. we should be able to get this to work without using workaround. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
In summary, to fix this you need to unbind The resulting keymap file looks like this (macOS): {
"context": "Workspace",
"unbind": {
"cmd-w": "workspace::CloseActiveDock"
}
},
{
"bindings": {
"cmd-w": [
"pane::CloseActiveItem",
{
"close_pinned": false
}
]
}
}TBH, this should be the default as the current default is confusing. |
Beta Was this translation helpful? Give feedback.
-
|
@semaperepelitsa - thank you very much. You fixed it for me. No hack needed. Good, it only took about 7 months!! |
Beta Was this translation helpful? Give feedback.






Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, Cmd-W (on Mac) or Ctrl-W (on Windows) is mapped to several actions including
pane: close active itemandworkspace: close active dock.It’s been frustrating for me to accidentally close the left dock when I meant to close the visible open document. To reproduce:
Expected behavior: The file closes.
Actual behavior: The left panel closes.
In VS Code, Cmd-W/Ctrl-W does not close the file panel. It closes the document.
Beta Was this translation helpful? Give feedback.
All reactions