Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open multiples files in one Code instance from command line?

If I open a file in Visual Studio Code from the command line or from within File Explorer, each file will open in a separate Code instance. Is there a way to make them all open in the same instance? I.e. add them all to the 'Working Files' list?

like image 947
DavidA Avatar asked Sep 23 '15 13:09

DavidA


People also ask

How do I open multiple files in CMD?

To open multiple files from a command line, type the following command, then press Return: gcrystal file1 file2 file2 ... where file1 and others, might be relative, absolute paths or uris. When the application starts, a Gnome Crystal window is created for each file that you specified.

How do I open multiple files or code?

Launch VS Code and press the “Ctrl” and “P” keys simultaneously to search for a file to open in the current project. Type in the file name. To open the new file in a temporary tab, click on it once. To open the new file in a separate window that you can choose to close manually, double-click it.

Can I open multiple folders in VS Code?

You can work with multiple project folders in Visual Studio Code with multi-root workspaces. This can be helpful when you are working on several related projects at one time. For example, you might have a repository with a product's documentation that you like to keep current when you update the product source code.

How do I run multiple instances of VS Code?

Ctrl + Shift + N will open a new window, while Ctrl + K then releases the keys, and pressing O would open the current tab in a new window. You can then use menu File → Open Folder to have two instances of Visual Studio Code with different folders in each window. ⌘ + Shift + N and ⌘ + K for Mac.


2 Answers

Upcoming version will have a new option files.openInNewWindow which you can set to off to always open files into the last active instance. This is then identical to starting VS Code with the -r option but is much nicer to use (e.g. when you open a file from the desktop).

Update for our VS Code 1.0 release:

The setting is available as window.openFilesInNewWindow

like image 130
Benjamin Pasero Avatar answered Oct 11 '22 21:10

Benjamin Pasero


You can use the command line option of -r or --reuse-window to assure it opens in the last active VS Code window

You can review the other options here

like image 31
Brocco Avatar answered Oct 11 '22 20:10

Brocco