I have a file, xyz.cpp. I want to open two instances of this file in Visual studio (BTW, I am using Visual Studio 2005). Why would I want to do so? I want to compare two sections of the same file side by side. I know workarounds such as:
Make a copy of the file. But the problem is that it's not elegant, and I don't want to make copies every time I am faced with this.
I can split the window into two. The problem with split it that I can split it horizontally only. The result of a horizontal split is that the right half of my screen is white space.
If I were able to split it vertically or open two instances of the same file, it would increase the number of lines of code I can compare.
Use "Ctrl + Alt + D" to open multiple instances.
In the VS 2017, I can go Window->New Window to open the same file in left and right vertical tab.
You can simply do File>New Window and open the other project in the new window. Because after you close VSCODE and launch it again it opens only one of these two windows. But with workspace you keep both.
Open to the Side (Ctrl+Enter) from the Explorer context menu on a file. Click the Split Editor button in the upper right of an editor. Drag and drop a file to any side of the editor region.
Here's how to do it...
If New Window is not listed in the *Window menu note that the command does exist, even as of Visual Studio 2017. Add it to the Window menu using menu Tools → Customize → Commands. At that point decide where to put the New Window command and select Add Command.
UPDATED on "30 July 2018"
In Visual Studio Code version 1.25.1 and later
Way 1
You can simple left click on your file in the side-panel (explorer) and press Ctrl + Enter.
Way 2
Simply right click on your file in the Visual Studio Code side-panel (explorer) and select the first option open to the side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With