Open files always in a new tab
When you [single-]click a file in the left sidebar's file browser or open it from the quick open menu (Ctrl-P, type the file name, Enter), Visual Studio Code opens it in what's called "Preview Mode", which allows you to quickly view files.
Preview Mode tabs are not kept open. As soon as you go to open another file from the sidebar, the existing Preview Mode tab (if one exists) is used. You can determine if a tab is in Preview Mode, by looking at its title in the tab bar. If the title is italic, the tab is in preview mode.
To open a file for editing (i.e. don't open in Preview Mode), double-click on the file in the sidebar, or single-click it in the sidebar then double click the title of its Preview Mode tab.
If you want to disable Preview Mode all together, you can do so by setting "workbench.editor.enablePreview": false
in your settings file. You can also use the "workbench.editor.enablePreviewFromQuickOpen"
option to disable it only from the quick open menu.
Before you can disable Preview Mode, you'll need to open your Settings File.
Pro Tip: You can use the Command Palette(shortcut Ctrl+Shift+P) to open your settings file, just enter "Preferences: Open User Settings
"!
Once you've opened your settings file (your settings file should be located on the right), add the "workbench.editor.enablePreview"
property, and set its value to false
.
You can learn more about Visual Studio Code's "Preview Mode", here.
If you don't want to disable preview mode you can explicitly tell vscode
to keep a specific tab open. As mentioned above a tab heading with italic text is in preview mode.
To get a tab out of preview mode you can either right click on the tab and choose keep open
or use the shortcut cmd + k enter
that is mapped to the command workbench.action.keepEditor
.
Furthermore, double-clicking on a tab also gets it out of preview mode (verified in vscode
1.44.0).