I am trying to open a tab in a new window in Visual Studio Code so I can move it to another screen. If I drag the tab the other screen, a file is created. Is there a shortcut to open a tab in a new Visual Studio Code window so I can move it to another screen?
-
21Feature request for floating window support in the same instance: https://github.com/Microsoft/vscode/issues/10121 – Roy Tinker Feb 01 '18 at 19:28
-
1Try the following link as a workaround: [https://superuser.com/questions/1319288/vs-code-drag-tab-to-new-window/1319353#1319353?newreg=db761e3f719d484bb621b7d2b2f1e269] – Miles Buckton Oct 26 '18 at 13:14
-
Related to https://stackoverflow.com/questions/29964825/how-does-one-open-multiple-instances-of-visual-studio-code/29965036 discussed on Meta https://meta.stackoverflow.com/questions/378537/why-was-my-edit-adding-information-from-another-question-rejected/378538 for possible merge. – Slate Jan 04 '19 at 17:18
-
64 years later... – jeugregg Feb 11 '22 at 00:14
-
3And now it's 2023! – halfdanr Apr 13 '23 at 05:35
11 Answers
On Windows and Linux, press CTRL+K, then release the keys and press O (the letter O, not Zero).
On macOS, press CMD+K, then O (without holding CMD).
This will open the active file tab in a new window/instance.

- 3,807
- 3
- 33
- 50

- 11,376
- 1
- 9
- 12
-
37
-
140
-
186that should be WAY easier. I should just be able to drag the tab to an empty space and it opens. Dropping the file is a much less useful feature. – light24bulbs Oct 25 '17 at 13:53
-
38@light24bulbs - It's maddening that a tool for developers is so clumsy. This doesn't even close the existing tab (so now I have 2 copies open)! – charles-allen Dec 11 '17 at 08:47
-
2It's `CMD+K` and then `o` for Mac VSCode to open the current file in a new window/instance – johnnyB Dec 14 '17 at 00:11
-
2This only works for some tabs. I could open source files and the settings JSON in a new window like this, but it didn't work for release notes or the PDF preview of LaTeX Workshop. The error message tells me to first open the file before opening it in a new window. – Daniel Saner Jun 08 '18 at 08:05
-
41While handy, I'd like to point out to anyone wondering, this only opens the same file in a new instance of VS code. Changes aren't persisted either across instances. If I have a markdown doc open in one instance, and I "ctrl-k, o", it opens the same md doc in a new VS code, and opening the preview on one screen, the preview will not reflect changes from the other instance even after saving – Steve Eggering Sep 11 '18 at 18:40
-
-
3This is a good example of how developers cornered themselves by the technology they have chosen: https://github.com/Microsoft/vscode/issues/10121#issuecomment-287059917 – C-F Jul 30 '19 at 22:49
-
3with version 1.41.0 (latest as of this comment date), cmd+k and then o does open a new instance, and it DOES recognize changes made in both instances and even allows you to compare and accept or reject changes from both upon saving – Jar Dec 27 '19 at 02:43
-
1I was trying to drag drop tab outside vscode and expecting it to open file in new window. Also tried to right click on tab and finding "open in new window". Wasnt there. Also am developing against wsl2. And I feel, since opening file in new window creates new instance of vscode, it seems it also ended up forking new instance of node server to establish separate communication link between new vscode instance and wsl2. Single node server was consuming 30+% of processor already. Now two node servers are keeping my CPU usage constantly above 80%. Is my understanding of whats happening correct? – Mahesha999 Sep 02 '20 at 14:37
-
4They sure invent the most unintuitive ways.. I mean what's wrong with dragging the tab out?! Excuse me, I'm gonna jump out the window! ^.^' – DinoSaadeh Feb 19 '21 at 10:55
-
You’re right.But I answered in 2017, now is 2021. So, I think you know why. – kaijun Feb 20 '21 at 11:35
-
3This is the keyboard shortcut for the command "Open Active File in New Window", the keyboard shortcut can be different on your VSCode so I don't know why the poster didn't just give the name of the command instead of explaining the keyboard shortcut, also it won't work for With an unsaved file, it says "The active editor must contain an openable resource." – Ghos3t Jun 08 '21 at 21:41
-
Is this feature available via a menu somewhere, a right-click option, or the command palette as well? If so, what's it called? – Gabriel Staples Oct 14 '21 at 22:41
-
The answer should be this one: https://stackoverflow.com/a/67781453/1593800 – nđq Jul 17 '22 at 13:54
-
1Unfortunately, this works only for tab with code (or other editable resource). Not pdf files. – Antonio Sesto Dec 16 '22 at 12:57
-
2Helpful workaround. Unfortunately, navigating to related code in the extra tab won't work because its an extra instance of VsCode. Products from JetBrains allow to simply drag out the tab to another screen. – Stefan Apr 20 '23 at 07:55
-
1Could you please add to your answer: How's the command called that will be triggered? – DarkTrick Apr 21 '23 at 05:34
-
Getting "The active editor must contain an openable resource." when doing this. It looks like this method only works for text files. – mincom Aug 16 '23 at 03:46
This is a very highly upvoted issue request in Github for Floating Windows.
Until they support it, you can try the following workarounds:
1. Duplicate Workspace in New Window [1]
The Duplicate Workspace in new Window Command was added in v1.24 (May 2018) to sort of address this.
- Open up Keyboard Shortcuts Ctrl + K, Ctrl + S
- Map
workbench.action.duplicateWorkspaceInNewWindow
to Ctrl + Shift + N or whatever you'd like
2. Open Active File in New Window [2]
Rather than manually open a new window and dragging the file, you can do it all with a single command.
- Open Active File in New Window Ctrl + K, O
3. New Window with Same File [3]
As AllenBooTung also pointed out, you can open/drag any file in a separate blank instance.
- Open New Window Ctrl + Shift + N
- Drag tab into new window
4. Open Workspace and Folder Simultaneously [4]
VS Code will not allow you to open the same folder in two different instances, but you can use Workspaces to open the same directory of files in a side by side instance.
- Open Folder Ctrl + K,Ctrl + O
- Save Current Project As a Workspace
- Open Folder Ctrl + K,Ctrl + O
For any workaround, also consider setting setting up auto save so the documents are kept in sync by updating the files.autoSave
setting to afterDelay
, onFocusChange
, or onWindowChange
-
1This has a real problem for me suddenly. When I open the second window, that instance has no working directory. This makes all my linters go crazy, as they can't find references. – Jamie Marshall Nov 06 '21 at 17:59
-
Unfortunately not compatible with debugging ;__; The new window or workspace has no knowledge of the other one. Breakpoints don't sync for instance. All I wish is to have local variables on one screen and my code on the other, as they don't fit side by side with a vertical monitor. – FrostKiwi Aug 23 '22 at 02:19
-
Still open and locked. We can't even upvote on it anymore. Stuck in the backlog and ignored – John Demetriou Jun 02 '23 at 08:04
When I want to split the screens I usually do one of the following:
- open new window with: Ctrl+Shift+N
and after that I drag the current file I want to the new window. - on the File explorer - I hit Ctrl+Enter on the file I want - and then this file and the other file open together in the same screen but in split mode, so you can see the two files together. If the screen is wide enough this is not a bad solution at all that you can get used to.
-
5Thanks @nisanarz this works but I think it would be more convenient if it would be possible to pop out the window like in Visual Studio. Also for the new window to act on the same code base when searching and opening new files. – doorman Apr 12 '17 at 07:18
-
couldn't make the other options work with unsaved files. This one works fine – Artur Carvalho Mar 07 '23 at 08:41
-
I mean seriously, how is this not fixed yet? I know this is not an IDE, but so many IDEs I just drag the tab outside and it creates a new window automatically – John Demetriou Jun 02 '23 at 08:02
With Visual Studio 1.43 (Q1 2020), the Ctrl+K then O keyboard shortcut will work for a file.
See issue 89989:
It should be possible to e.g. invoke the "
Open Active File in New Window
" command and open that file into an empty workspace in the web.

- 1,262,500
- 529
- 4,410
- 5,250
If the accepted answer isn't working for you, for example, your shortcut key may have been changed to do other things. You can launch the command input by Ctrl + Shift + P
, then type 'new window' and you will see the result File: Open active tab in a new window
, and select it.

- 418
- 4
- 13
Just an update, Feb 1, 2019: cmd+shift+n
on Mac now opens a new window where you can drag over tabs. I didn't find that out until I when through KyleMit's response and saw his key mapping suggestion was already mapped to the correct action.

- 197
- 3
- 12
-
1This is not the same thing as duplicating the workspace, though, because any dependencies or functions from libraries will not be loaded for your linters. A new windows lets you look at files, but it lacks all the functionality of a workspace. – mbomb007 Jan 10 '20 at 15:26
Press Command+K (wait, it will wait for pressing any key which you can see in the below bar) then press O.
So, it is Cmd+k+ O
(space represents little wait).

- 874
- 10
- 9
I found a way to achieve the "Duplicate Workspace in New Window" workflow from @mbomb007's workarounds via the command line:
Normally code --new-window <path-to-folder>
will not open a new window if that folder is the root of an existing window.
code --new-window <path-to-some-file>
followed by code --add <path-to-folder>
does the trick. I put a 1s delay between those commands.
Issue #2686 was closed with a recommendation for users to use the "Duplicate Workspace in New Window" workflow, but didn't include a CLI solution. I would have posted this workaround there, but it's locked.

- 41
- 4
I wanted to use my second screen for viewing a preview of a document. None of the suggestions worked well since the preview was not updated in the second window, even when the workspace was duplicated and autosave enabled.
My workaround was to simply increase the size of the window to span both screens, and use the standard split tab.
To expand one window across two screens, I recommend Microsoft PowerToys. The FancyZones feature can be configured to allow zones to span across monitors, so a custom canvas can be created to quickly expand a single window to both screens.

- 565
- 4
- 10
You can also hit Win+Shift+[n]. N being the position the app is in the taskbar. Eg if it's pinned as the first app hit WIn+Shift+1 and windows will open a new instance and then you can drag the tab over to the new window.
Most convenient workaround for me so far.

- 741
- 7
- 17
If you are using the excellent
VSCode for Mac, 2020
simply tap Apple-Shift-N (as in "new window")
Drag whatever you want there.

- 27,874
- 70
- 431
- 719