VSCode Stop tabs from being replaced when opening a file

October 20, 2026

Are you ever annoyed that VSCode replaces the tab you just opened when you click another file? Thank god there’s a simple fix for that.

When you single-click a file, VSCode opens it in “preview mode”. You can see it because the tab name is in italics. The next file you click replaces it, so the file you wanted to keep is gone.

Prerequisites

  • VSCode installed

Steps to disable preview mode in VSCode

  1. Open Settings using CTRL + , on Windows or ⌘ + , on Mac
  2. Search for workbench.editor.enablePreview
  3. Uncheck Workbench > Editor: Enable Preview
  4. If you also want files opened with ⌘ + P to stay open, uncheck Workbench > Editor: Enable Preview From Quick Open

If you prefer editing the settings.json directly, add this:

"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false

If you don’t want to turn it off completely, double-click the file instead. That opens it in a normal tab.

Now that every file gets its own tab, it’s a good idea to also set a maximum amount of opened tabs.


Profile picture

Written by An anonymous coder who lives and works building useful things. Mostly focusing on Django, Vue and overall Python examples.