[visual-studio-code] Open files always in a new tab

I am using Visual Studio Code 1.3.1 with the newly introduced tabs.

When I click on files, the first file will open in a tab. If I do not make any changes to this file, the second clicked file will open in the same tab.

How can I avoid this and make Visual Studio Code always open a new tab?

This question is related to visual-studio-code

The answer is


? Actually, VSCode shows you the preview of a file.

You can disable the preview with this:

"workbench.editor.enablePreview": false,

?? Basically just add these two settings and you're good to go.

VSCode tip


Menu File ? Preferences ? User Settings: add this line "workbench.editor.enablePreviewFromQuickOpen": false


I came up with the same problem, and open setting.json file, add the following:

"workbench.editor.enablePreview": false

Settings -> Workbench -> Editor Management -> Enable Preview


you need edit setting.json file,

settings.json, located at

Windows %APPDATA%\Code\User\settings.json
macOS $HOME/Library/Application Support/Code/User/settings.json
Linux $HOME/.config/Code/User/settings.json


        {
          "workbench.editor.showTabs": true,
          "workbench.editor.enablePreview": false
        }

Open in new Tab Solution:

  1. Open the command palette by: Cmd + Shift + K
  2. Open settings file by: Preferences: Open Settings (JSON)
  3. Under user setting, enable Tabs by: "workbench.editor.showTabs": true

For anyone who don't want to disabled Preview Mode.

As I read whole of comments and I found what I preferred that is the shortcut key to pin the opened file from Quick Open/Ctrl+P or that's mean to keep the opened file to the editor, and yes also don't need to switch your hand to the mouse to double-click on files list.

Thanks to @jontem and @MattLBeck.

Call save command with Ctrl+S (?+s on Mac) is the easiest way to reach what I preferred.

And if you found out you do this to keep opened file to editor quite frequently, yes I preferred you should setting the option "workbench.editor.enablePreview": false or "workbench.editor.enablePreviewFromQuickOpen": false as others mentioned before.


For those who using Windows OS:

  • Press Ctrl + Shift + P
  • Select Preferences: Open Settings (JSON) from the list
  • Select all and Paste this { "workbench.editor.enablePreview": false }

That's it now it will open in a new tab instead of replacing on the existing one.

For reference look at the screenshot below:

enter image description here


In my case, I also had to set workbench.editor.showTabs property to true (in addition to workbench.editor.enablePreview)

I'm not sure how it got changed to false. Maybe, I've accidentally set it to false using some shortcut.


Essentially, there are three settings that one has to update (Preference >> settings):

  • workbench.editor.enablePreview: set this to globally enable or disable preview editors

  • workbench.editor.enablePreviewFromQuickOpen: set this to enable or disable preview editors when opened from Quick Open

  • workbench.editor.showTabs: finally one will need to set this
    otherwise, there will be no tabs displayed and you will just be
    wondering why setting/unsetting the above two did not work


Actually, VSCode shows you the preview of a file when you open it. If you want to open files in a new tab, just disable the preview with this setting (paste this in the settings.json file).

"workbench.editor.enablePreview": false, 

— you can take it one step further and use this setting

"workbench.startupEditor": "newUntitledFile",

— It will open your VSCode editor with a blank new untitled file to quickly get started.


As hktang above indicates:

one Click opens the file in preview mode (header text in italics)

Double click the same file, it goes out of preview-mode (header text changes from italic to normal font)

I think this is a "comprimise" feature allowing users, to "navigate" both worlds; preview and none-preview.

  • All you do is click the file to open it in the right panel.
  • Then immediately double click it to keep it there.
  • Or - just treble click. File opens in none preview mode.

HTH Paul S.


This is so confusing. All developers I asked didn't appreciate this default behavior.

I use cmd + P to open project files.


For 2020 ..

easy as pie, tap preferences (eg, apple-comma on a Mac),

they added it right there:

enter image description here

Turn "off" for normal behavior. (IE, to avoid the "automatic closing" behavior.)


for me, shift + enter did the trick.


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).


Simple and Best way is whenever you open new file it is in preview mode so simply press the CTRL + K and then press ENTER then you done with preview mode , Now this file will remain always open until you closed it that's what you need to do ....


This is not a new answer. It is just showing how to do it via UI. Open settings via File => Preference => Settings. The most upvoted answer is the correct choice.

Then in search field type Preview.

After that select Workbench and look for Enable preview options.

Uncheck the boxes.

enter image description here


If you have opened a file in preview mode and want to open new file in another tab: For Mac: use cmd + p -> find the file and alt + enter.


You can do it via GUI

enter image description here

Search for preview

enter image description here

uncheck the options Enable Preview and Enable Preview from Quick Open


Watch for filenames in italic

Note that, the file name on the tab is formatted in italic if it has been opened in Preview Mode.

Quickly take a file out of Preview Mode

To keep the file always available in VSCode editor (that is, to take it out of Preview Mode into normal mode), you can double-click on the tab. Then, you will notice the name becomes non-italic.

Feature or bug?

I believe Preview Mode is helpful especially when you have limited screen space and need to check many files.


One simple solution is, instead of making changes in settings of vscode, whenever you open a file through a reference,you will see that the file is in preview mode(the name of file is in italic) and in the sidebar you will see that same preview file in focus just double tap it and it will be pinned on the tab,so that it wont get replaced by another file in preview mode.


enabling using GUI

go to Code -> Preferences -> Settings -> User -> Window -> New Window

here Open Files In New Window under drop down list select "on" that's it.

my VS Code version 1.38.1


Use workbench.editor.enablePreview: false to disable Preview mode completely.

Use workbench.editor.enablePreviewFromQuickOpen: false to disable Preview mode for the files open from quick open menu.


If you want to open a file permanently from "Go To File..." (?P), press "right arrow" instead of return.

This also keeps the Go To File... search bar open so you can quickly open multiple files.