246

I want to be able to edit one method while looking at another method in the same file, as reference. Can this be done?

2

8 Answers 8

361

You can open the file in another tab (Window -> New Window).

Doing so you have two copies of the same file. Then you can right-click the tab bar and select New Vertical Tab Group (or New Horizontal Tab Group, the one you like more).

Hope I understood you question..

5
  • 61
    VS 2013 made it simpler - Window -> Split
    – Bakudan
    Commented Dec 17, 2015 at 10:57
  • 21
    True, it splits only vertically though
    – p4bl0
    Commented Mar 29, 2017 at 10:32
  • 9
    Just wanted to add a keyboard shortcut for this: 1) Alt + w,n for New Window and Alt+w,v for New vertical tab group Commented Dec 11, 2019 at 15:27
  • 1
    To get the window arrangement I want, I usually just grab any source file from the source window, drag it out so it's free floating, and then you can use the "target" icons in the middle to dock it wherever you want, creating a second tab group. Then do the Window -> New Window, and finally drag the new view of your file to the second tab group. Yes, I do admit it's a bit of work, but I've done it often enough it's pretty much muscle memory by now.
    – dgnuff
    Commented Jun 26, 2021 at 22:27
  • What a shame. Notepad++ is doing it more professional than M$ Visual Studie. After > 1 Decade, we still have to do 5 steps, just because M$ is not willing to do the homework and offer a "Open File in other Document Group" command.
    – Tom
    Commented Dec 20, 2022 at 21:20
105

Be on the tab you want to duplicate,
then click in the menu bar at the top on
Window > New Window

Finally drag & drop the second window to the the left or right side to show both views next to each other.
Et voila, there you have it :)

image insturction 1 image insturction 2

EDIT

It seems that this function is not implemented in all version of VS.
In my case (V 15.4.2 (2017), V 15.9.7 (2017) & V 16.2.5 (2019)) it just works fine.

Version 15.9.7

7
  • 1
    This does not work in VS 2015. It says that that tab is open and then closes it and reopen it.
    – EpiX
    Commented May 14, 2018 at 22:20
  • 1
    @RyanLee it does work for me, i haven't changed any settings, don't know where the problem could be.
    – Hille
    Commented May 15, 2018 at 10:32
  • I can confirm that this doesn't work in SSMS v17.4, for the same reason as stated by @RyanLee.
    – BigSmoke
    Commented Aug 20, 2018 at 8:35
  • 1
    Works on 2017. And to complete the answer - Once you have the new tab, drag it and dock it to the side of the original tab Commented Nov 21, 2018 at 7:57
  • 1
    Works in Version 16.7.2
    – bombek
    Commented Aug 20, 2020 at 8:25
80

Only vertically that I'm aware. When looking at the code, right above the vertical scroll bar is a small rectangle, drag it down to get a split view of the file.

0
47

You simply use the small drag arrows icon at the top right corner of your file window as depicted in the following screenshots:

Before dragging

After dragging

2
  • 3
    tab groups is a vertical split, you have demonstrated a horizontal split.
    – odyth
    Commented Jan 1, 2019 at 2:44
  • What is the keyboard shortcut for switching between this?
    – pcbabu
    Commented May 9, 2019 at 18:11
20

1) View the same document side-by-side (with a fix for Visual Studio 2017)

It is possible to do this using New Window and New Vertical Tab Group, however, in my Visual Studio 2017 the New Window command was missing from the Window menu. To use it, first you must add the command to a menu or assign a shortcut to it.

To add New Window to your Window menu follow this sequence, starting with the Tools menu:

Tools > Customize > Commands > Menu Bar > Window > Add Command > Window > New Window

FYI In the Commands step you decide where to put the New Window command. The sequence I gave above puts it unceremoniously at the top of the Window menu.

To view the same document side-by-side

  1. Open the document you want to view side-by-side
  2. Select your recently added New Window command (perhaps it's in Window > New Window)
  3. Right click the new tab and select New Vertical Tab Group or select that command from the Window menu

2) View the same document above-one-another

If you wish to view the same document in two views on top of each other use the Window > Split command or click-and-drag the double-arrow at the top of the scroll bar for any window.

3) Get creative

FYI You can even combine the two view options to have three, four or even more views of the same document on a particularly wide monitor. On mine (2560 x 1080) I can comfortably get three side-by-side views going and split them vertically, if desired. multiple panes

2
  • This doesn't work in SSMS v17.4. When clicking New window, it will ask me whether to close to current window or not.
    – BigSmoke
    Commented Aug 20, 2018 at 8:36
  • This works on Visual Studio 2022 (17.10) Commented Jun 2 at 14:00
6

One can install VsVim extension and :sp :vsp does the trick.

3

In Visual Studio 15 you can just click inside the document and then "Window → Split"

0
0

Since this is quite old and there's a new more efficient way of doing this: While in Visual Studio open document you want to see in split view and click on: Window > Split

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.