Reputation: 2008
For context; I have a markdown file named tasks.md
as a pinned tab in which I keep my todo-list. I'm accustomed to hitting Ctrl + w
to close all unused files, but it also closes this pinned tab.
Is it possible to designate a file as "impossible" to close without changing a vscode setting?
Upvotes: 1
Views: 1467
Reputation: 1329662
Sept. 2020, with VSCode 1.50, the PR 106385 will fix that issue.
Addresses a couple of pain points with pinned tabs:
Regarding the context, this comment from Benjamin Pasero (who is part of the development team for VSCode) adds:
After a bit more thought I decided to make
normal
the default option for thepinnedTabSizing
option because it makes sense to have the default be the normal choice and I feel that forcing a pinned tabs to shrink maybe unexpected for users that see this for the first time.Setting it to
compact
orshrink
should be an explicit choice by the user and is then a lot more understandable.
With VSCode 1.51 (Oct. 2020):
More prominent pinned tabs
Pinned tabs will now always show their pin icon, even while inactive, to make it easier to identify them.
If an editor is both pinned and contains unsaved changes, the icon reflects both states.
And make sure to use VSCode 1.82 (Aug. 2023): issue 115734 reported "Add setting to prevent closing the pinned tab when using middle click"
A pinned tab cannot be closed with ctrl + w, but it can be closed with the mouse (middle click).
PR 188592 adds the setting:
workbench.editor.preventPinnedEditorClose
:always
: Always prevent closing the pinned editor when using mouse middle click or keyboard.
onlyKeyboard
: Prevent closing the pinned editor when using the keyboard.
onlyMouse
: Prevent closing the pinned editor when using mouse middle click.
never
: Never prevent closing a pinned editor.
Upvotes: 3
Reputation: 989
Without changing settings: Keyboard Binding Logic File > Preferences > Keyboard Shortcuts
it's not possible currently. Upvote this Prevent closing the pinned tab when using Ctrl + W feature request in the VS Code Issue tracker. It'll get to VS Code Dev's backlog if it gets more than 20 upvotes in 60 days (August 21, 2020).
Upvotes: 1