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?
-
24Feature request for floating window support in the same instance: github.com/Microsoft/vscode/issues/10121Roy Tinker– Roy Tinker2018-02-01 19:28:14 +00:00Commented Feb 1, 2018 at 19:28
-
1Try the following link as a workaround: [superuser.com/questions/1319288/vs-code-drag-tab-to-new-window/…Miles Buckton– Miles Buckton2018-10-26 13:14:13 +00:00Commented Oct 26, 2018 at 13:14
-
Related to stackoverflow.com/questions/29964825/… discussed on Meta meta.stackoverflow.com/questions/378537/… for possible merge.Slate– Slate2019-01-04 17:18:33 +00:00Commented Jan 4, 2019 at 17:18
14 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.
20 Comments
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.duplicateWorkspaceInNewWindowto 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

4 Comments
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.
4 Comments
With Visual Studio Code 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 Comment
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.
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).
3 Comments
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.
1 Comment
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.
Comments
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.
Comments
You can find all issue tickets related to this feature by filtering with the workbench-auxwindow ("auxiliary windows") label in the issue tracker.
I'll try to keep this answer as up to date as I can with those developments.
VS Code 1.86 update
There's now a "Open Output in New Window" action in the Output Panel's title menu (source), and Notebooks are supported for floating windows (source).
VS Code 1.85 update
You can now drag editor tabs out of a window to create a new window for them. If you want to disable this, use the workbench.editor.dragToOpenWindow setting.
Commands and keybinding command IDs include:
- View: Copy Editor into New Window (
workbench.action.editor.copyWithSyntaxHighlightingAction) - View: Move Editor into New Window (
workbench.action.editor.moveEditorToNextWindow) - View: Copy Editor Group into New Window (
workbench.action.editor.copyGroupToNextWindow) - View: Move Editor Group into New Window (
workbench.action.editor.moveGroupToNextWindow) - View: New Empty Editor Window (
workbench.action.newWindow)
Terminals and search results are also supported in floating/auxiliary windows now too.
The right click / context menus of editor tabs now have the entries "Move into New Window" and "Copy into New Window".
VS Code 1.83/1.84 update
The VS Code team is now experimenting with implementation of floating windows in the latest VS Code Insiders (source: 1.83 release notes and 1.84 release notes). Quoting from the 1.83 release notes:
All editors across all windows operate on the same underlying editor models, so that changes made in one window are reflected live in all other windows. You can create any editor layout in the floating windows and open any editor you like, in as many windows as you want.
For our first working version, we envision that the Status bar would also be present in the floating windows so that editor information - such as line numbers and selection ranges - is shown. Stay tuned for more development in the coming months!
Currently, there is a command named View: Move Active Editor into a New Window (Experimental) with ID workbench.action.experimentalMoveEditorIntoNewWindowAction (if you want to bind a keyboard shortcut to it).
VS Code 1.82 answer
As for right now in the stable release of VS Code, the best workaround I see is to use the File: Open Active File in New Window command, which is bound by default to ctrl/cmd+k,o, or to manually open a new window, and drag the editor over there. But those aren't great because the file will be opened standalone, without any of the context of the workspace it was opened from (without workspace settings, extensions enabled for that workspace, workspace tasks, project configuration for that workspace, etc.). If you don't want that problem, then you can open the same workspace in a new window. I guess the downside of that could be that it could potentially use more system resources (Ex. extension host, filesystem watchers to keep the multiple windows with the same workspace in sync, etc.).
I thought I'd take the opportunity to highlight comments from the issue ticket that explain what makes this a hard problem to tackle / hard feature to implement (seriously- this is why I tell people not to make "+1" / "bump" comments. that thread is a swamp and an absolute nightmare to try to read through if you want to actually find the meaningful discussion). According to the maintainers, the challenge mostly comes difficult architecture changes and keeping good performance (source).
https://github.com/microsoft/vscode/issues/10121#issuecomment-287059917
https://github.com/microsoft/vscode/issues/10121#issuecomment-345497635 TL;DR: Chromium's process-isolation makes this harder to implement.
https://github.com/microsoft/vscode/issues/10121#issuecomment-345770248 TL;DR: Each piece of the workbench would need refactoring to be self-contained, the master window would need to know what window each of its parts are in, and several services like the extension host would need to be moved into a shared backend that each window can communicate with (I wonder if the sandbox work helps with this?).
3 Comments
Thanks to a recent update in VSCode, you can now just drag the file to an empty location and it will popup a new window! (Provided your VSCode version is > v1.85.x)
I am personally running VSCode in WSL2 and it works great for me!
1 Comment
Here is a demo - it is available in Insiders now - of the ability to open an editor in a new window as mentioned by @starball.
There is this setting which is enabled by default:
Workbench > Editor: Drag to Open Window
Controls if editors can be dragged out of the window to open them in a new window. Press and hold Alt-key while dragging to toggle this dynamically.
This means that you could disable that setting but still drag and drop an editor or editor group to create a new file by also holding down the Alt key at the same time.
You can either drag an editor (or an editor group) out of the current window to open all of them in a new window OR use a command on the current editor.
The commands are
View: Move Editor into New Window
workbench.action.moveEditorToNewWindow
workbench.action.experimentalMoveEditorIntoNewWindowAction
View: Move Editor Group into New Window
workbench.action.moveEditorGroupToNewWindow
View: Copy Editor Group into New Window
workbench.action.copyEditorGroupToNewWindow
View: Copy Editor into New Window
workbench.action.copyEditorToNewWindow
Those currently do not have a default keybindings.
In addition, each editor tab's context menu includes 2 new options:
Move into New Window
Copy into New Window
The editor group tab bar also includes these context menu options, see demo:
The Copy versions will make another copy of the current edit group or editor in a new window without removing them from the original window.
Tabs can be dragged back and forth between the new window and the main workspaces window. The floating window has no views or panels associated with it - like the SideBar or Panel where the terminal typically lives.
Demo using the editor move command:
On a drag and drop (currently on dragging it appears as if it cannot be dropped - ignore that for now, it can be dropped) the new window's top left will be located where it is dropped.
Demo showing dragging an editor group:
Note that to drag an entire group you start from the area to the right of the group - click and drag.
To drag an individual file click and drag from it's tab.
You can have mutiple floating or detached windows open, and you can drag editor tabs between them.
For multiple monitors, you can have the windows on any of the monitors but a new window created by command or context menu option is created on the same window. To actually get a new window to another monitor you have to drag and drop it there.



