Split edit window in Visual Studio
Asked Answered
L

10

83

Is there any way to show two editing windows in Visual Studio?

I would like to look at two source files at the same time, but I cannot find the option to do that.

Leucopenia answered 16/11, 2008 at 21:54 Comment(0)
C
67

Another easy option is to open two documents, then just click and drag the tab for one of the documents and drop it on the document itself. This will display a menu that lets you move the document to a new vertical or horizontal tab group.

I find this to be the easiest and quickest way to do this.

You didn't ask in the question, but if you want to edit one document in two windows, you can grab the small area above the scrollbar and drag it down. You will now have your document open in two scrollable areas. Great for working on two sections at once.

Christman answered 16/11, 2008 at 21:57 Comment(5)
Another way to edit one document in multiple (also more than 2) 'real' windows (which can float/dock/...): select the document, Window->New Window.Micrometer
@Micrometer 's comment is the correct answer.Galba
Please add the shortcuts for new (vertical/horizontal) split view? And new window? I'm used to QtCreator and I'm wondering if I can get the same functionality on Visual Studio.Katar
Which version of Visual Studio are we talking about, 2019/2022?Katar
I tried this and it didn't work.Temporal
D
128

I think what you want to do is to add a new vertical tab group. The keyboard shortcut to do that is

Alt + W, V.

According to this source, it works for Visual Studio 2005, 2008, and 2010. In my experience, it also works for Visual Studio 2013.

Dibrin answered 11/12, 2015 at 17:24 Comment(8)
This also works for Visual Studio Community 2015. I am able to see my .less and .css file side by side. As I update my .less file the .css file changes. nice!Tamtam
this is definitely the easiest way! Thank youKassia
is it possible to just create a new group without having a split window ?Justino
It doesn't work for me with Visual Studio 2019 (on windows 10)Agonist
This is the one I'm looking for Thanks!Susannsusanna
Perfectly works in Visual Studio 2022 on Windows 11.Soot
Alternatively click menu "Windows" --> "New Vertical Document Group"Soot
it makes tabs side by side but not for the same document. If you wanna do this, Window -> New Window. Then yes: Alt+W, VSlavocracy
C
67

Another easy option is to open two documents, then just click and drag the tab for one of the documents and drop it on the document itself. This will display a menu that lets you move the document to a new vertical or horizontal tab group.

I find this to be the easiest and quickest way to do this.

You didn't ask in the question, but if you want to edit one document in two windows, you can grab the small area above the scrollbar and drag it down. You will now have your document open in two scrollable areas. Great for working on two sections at once.

Christman answered 16/11, 2008 at 21:57 Comment(5)
Another way to edit one document in multiple (also more than 2) 'real' windows (which can float/dock/...): select the document, Window->New Window.Micrometer
@Micrometer 's comment is the correct answer.Galba
Please add the shortcuts for new (vertical/horizontal) split view? And new window? I'm used to QtCreator and I'm wondering if I can get the same functionality on Visual Studio.Katar
Which version of Visual Studio are we talking about, 2019/2022?Katar
I tried this and it didn't work.Temporal
A
29

In Visual Studio Community 2019 to split a document (code) and have two independent views of the code, there is a little tool in the top right corner of the display:

enter image description here

Just drag it down and you will get another viewer for the current file. To adjust the height you can grab the bar between the two views and drag. (Can be kinda tricky, just move your mouse until the mouse pointer icon changes to double arrows)

To split the view between two files just right-click on one of the files tabs (title) then in the resulting menu you can select either "New Horizontal Document Group, or New Vertical Document Group:

enter image description here

Arran answered 29/9, 2021 at 14:22 Comment(3)
I don't see this in Visual Studio 22 for MacAutolithography
my New Horizontal Document Group disappeared (VS 2022). I'm sure I saw it somewhere beforeBreughel
The shortcuts pleaseKatar
C
28

To create a keyboard shortcut for "Window->New Vertical Tab Group" you need to assign a shortcut to "Window.NewVerticalTabGroup" command.
Tools->Options->Environment->Keyboard, in "Show commands containing" type "Window.NewVerticalTabGroup", and assign the keyboard shortuct in "Press shortcut keys" field.
Remember to click "Assign" before "OK".

Canzone answered 9/5, 2009 at 15:49 Comment(2)
It seems that in Visual Studio 2010 & 2012 Window.TileVertically become Window.NewVerticalTabGroupHaiku
What about VS 2019/2022?Katar
H
10

For Visual Studio 2012:

Move your mouse over the Class tab > Right Click on the Title of the Class > New Horizontal Tab Group or New Vertical Tab Group.

If you want to split the same class: Tools -> Options -> Environment -> Keyboard -> search by Window.Split and add a new shortcut.

Hanshaw answered 9/4, 2014 at 18:52 Comment(0)
D
7

In Visual Studio 2022.

To edit the same file side by side (vertically split the editing window) without actually making a new copy of the file, you:

  • Select the file (tab) to split.
  • Choose "Window" -> "New Window" from the menu.
    Window -> New Window
    The selected file (tab) is split in to two files (tabs), ending with :1 and :2.
    It's the same file, NOT a copy of the first file.
  • Right click on one of the files and select "New Vertical Document Group" to split the editing window into two parts.
    New Vertical Document Group
Dollop answered 10/10, 2023 at 18:32 Comment(3)
Sorry, but I did exactly as you explained, and as of today sadly, there is no such option.Nauseating
I don't now what version you are using but in Visual Studio 2022 there is such an option. I just tried to do it again in version 17.9 and 17.10 of Visual Studio 2022 and it works just fine...Teyde
https://mcmap.net/q/243998/-how-do-i-vertically-split-the-same-file-in-visual-studio-editorTeyde
F
3

In Visual Studio 2015:

Right click on the (file name) tab and select vertical split or horizontal split.

Forjudge answered 21/8, 2018 at 13:7 Comment(0)
B
0

In newer Visual Studio versions (I can confirm this for Visual Studio 2017 15.9.55 and newer versions), you can do: Window -> Split. You can also unsplit following the same way. This will work so for the current active tab.

Boldfaced answered 6/7, 2023 at 13:20 Comment(0)
H
0

You can use my Task Canvas extension to look at several source files at the same time:

enter image description here

Hypoplasia answered 3/12, 2023 at 4:21 Comment(0)
L
0

I know this answer is a little unrelated, but I came here because I was trying to a split with the same window. In case you're like me trying to do this, just go to Window > Split

enter image description here

Laceylach answered 18/4 at 19:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.