I’d suggest that you raise a feature-request issue ticket. If you do, please comment here with a link to it or edit the link into this question post.
If/when you raise an issue ticket, be aware that there are nuances- terminals aren’t constrained to tabs in the Terminal Panel- they can be moved into the editor area as editor tabs as well. There’ll probably need to be some design discussion surrounding that.
It works for multiple terminal tab selections too.
It closes all the other editors other than the one(s) that are selected when you right-click on one of those. You can right-click on any terminal tab – which may or may not be the currently active terminal.
You can use the Close other Terminals command from the Command Palette.
And you can create a keybinding to run the command (in your keybindings.json) like this:
{
"key": "alt+k",
"command": "close-other-terminals.close",
"when": "terminalFocus" // omit this to have it work in an editor
// see below to use terminalFocus when clause
}
If you want that when clause, make sure to add close-other-terminals.close to the following setting:
2
Answers
I don’t think this is a thing. To substantiate, at the time of this writing (VS Code 1.84):
github vscode issues kill all but active terminal
" yields nothing in the first page of resultsis:open is:issue label:terminal label:feature-request kill
in the issues tab yields nothingI’d suggest that you raise a feature-request issue ticket. If you do, please comment here with a link to it or edit the link into this question post.
If/when you raise an issue ticket, be aware that there are nuances- terminals aren’t constrained to tabs in the Terminal Panel- they can be moved into the editor area as editor tabs as well. There’ll probably need to be some design discussion surrounding that.
I made an extension to add such a command to the terminal tabs’ context menu:
Close other Terminals
Let me know if it works for you.
It works for multiple terminal tab selections too.
It closes all the other editors other than the one(s) that are selected when you right-click on one of those. You can right-click on any terminal tab – which may or may not be the currently active terminal.
You can use the
Close other Terminals
command from the Command Palette.And you can create a keybinding to run the command (in your
keybindings.json
) like this:If you want that
when
clause, make sure to addclose-other-terminals.close
to the following setting: