VSCode: How to Split Editor Vertically

Visual Studio-Code

Visual Studio-Code Problem Overview


In Visual Studio code, a while ago, when I used View->Split Editor, it would split vertically. (One file on the left and one file on the right.)

I updated Visual Studio Code and when when I do View->Split Editor, it always splits horizontally. (One file on the top and one file on the bottom.)

How can I split vertically?

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

Change editor split layout from horizontal to vertical

In 1.20

  • ALT+SHIFT+0 PC (Windows, Linux)
  • ++0 Mac

Pre-1.20

  • ALT+SHIFT+1 PC (Windows, Linux)
  • ++1 Mac

In 1.25

In 1.58.2 **

** Someone update this with the lowest version where this became true.

  • The menu entry with the shortcut given above is View=>Editor Layout=>Flip Layout

  • The Command Palette entry is labeled "Toggle Vertical/Horizontal Editor Layout"

  • The settings entry is

    {
      "key": "alt+cmd+0",
      "command": "workbench.action.toggleEditorGroupLayout"
    }
    

Solution 2 - Visual Studio-Code

If you're looking for a way to change this through the GUI, at least in the current version 1.10.1 if you hover over the OPEN EDITORS group in the EXPLORER pane a button appears that toggles the editor group layout between horizontal and vertical.

Visual Studio Code - toggle editor group layout button

Solution 3 - Visual Studio-Code

To split vertically:

+\ Mac

command: workbench.action.splitEditor

To split orthogonal (ie. horizontally in this case):

+k++\ Mac

command: workbench.action.splitEditorOrthogonal

Solution 4 - Visual Studio-Code

Press CMD + SHIFT + P (MAC) and search for Toggle Editor Group

Solution 5 - Visual Studio-Code

In version 1.23.1, it is Ctrl+Shift+P and Split Editor This will divide the screens vertically and you can move through them using Ctrl+K+LeftArrow

Screenshot of the Split Editor

Solution 6 - Visual Studio-Code

By default, editor groups are laid out in vertical columns (e.g. when you split an editor to open it to the side). You can easily arrange editor groups in any layout you like, both vertically and horizontally:

To support flexible layouts, you can create empty editor groups. By default, closing the last editor of an editor group will also close the group itself, but you can change this behavior with the new setting workbench.editor.closeEmptyGroups: false:

enter image description here

There are a predefined set of editor layouts in the new View > Editor Layout menu:

enter image description here

Editors that open to the side (for example by clicking the editor toolbar Split Editor action) will by default open to the right hand side of the active editor. If you prefer to open editors below the active one, configure the new setting workbench.editor.openSideBySideDirection: down.

There are many keyboard commands for adjusting the editor layout with the keyboard alone, but if you prefer to use the mouse, drag and drop is a fast way to split the editor into any direction:

enter image description here

Keyboard shortcuts# Here are some handy keyboard shortcuts to quickly navigate between editors and editor groups.

If you'd like to modify the default keyboard shortcuts, see Key Bindings for details.

⌥⌘→ go to the right editor.
⌥⌘← go to the left editor.
⌃Tab open the next editor in the editor group MRU list.
⌃⇧Tab open the previous editor in the editor group MRU list.
⌘1 go to the leftmost editor group.
⌘2 go to the center editor group.
⌘3 go to the rightmost editor group.
unassigned go to the previous editor group.
unassigned go to the next editor group.
⌘W close the active editor.
⌘K W close all editors in the editor group.
⌘K ⌘W close all editors.

Solution 7 - Visual Studio-Code

Method 1

enter image description here

Method2

View -> Command palette -> type 'split'

enter image description here

Method3

enter image description here

Method4

enter image description here

Tip

Add a Keyboard Shortcut for split Editor

enter image description here

Solution 8 - Visual Studio-Code

Simply in windows

ctrl + @ (the button 2 in the upper horizontal row of numbers in keyboard)

Solution 9 - Visual Studio-Code

The key bindings has been changed with version 1.20:

SHIFT+ALT+0 for Linux.

Presumably the same works for Windows also and CMD+OPT+0 for Mac.

Solution 10 - Visual Studio-Code

Use Move editor into Next Group shortcut:

Mac: ^ + + Right/Left arrow

If you want to change shortcut:

  1. Open Command Pallette (macOS keyboard shortcut: + Shift + p)
  2. Select Preferences: Open Keyboard Shortcuts
  3. Search View: Move editor into Next Group

Solution 11 - Visual Studio-Code

To change the editor in Landscape and Vertical mode, follow the steps below.

  1. For example, open two files that you have in your left or right side bar, depending on where you are placed. By default it is always on the left.

  2. Now that you have both windows open, you have to use the key combination for PC (Alt + Shift + 1) for (Windows and Linux Operating Systems) or for MAC (Cmd + Option + 1), as commented here v-andrew.

Solution 12 - Visual Studio-Code

  • Right-click on the tab that you want to split it into another screen.

  • Then choose whether you want to split it (up-down | right-left).

I find this is the quickest way, and You can split it to as many screens as you want.

enter image description here

Solution 13 - Visual Studio-Code

The best way is to configure the VSCode settings to make the default behavior the way you want:

Split Editor (to a new editor group)

"workbench.editor.openSideBySideDirection": "right" // left/right (default)
"workbench.editor.openSideBySideDirection": "down"  // up/down

Split Editor in Group (does not create new editor group)

"workbench.editor.splitInGroupLayout": "horizontal" // left/right (default)
"workbench.editor.splitInGroupLayout": "vertical"   // up/down

Solution 14 - Visual Studio-Code

I just found a simple solution. You can drag an opened file and move towards the four sides of the Editor, it will show a highlighted area that you can drop to. It will split the view automatically, either horizontally, vertically, or even into three rows.

VSCode v1.30.2

Update: you can also drag a file from the Explorer to split the Editor in the same way above.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRainingChainView Question on Stackoverflow
Solution 1 - Visual Studio-Codev-andrewView Answer on Stackoverflow
Solution 2 - Visual Studio-CodeLance U. MatthewsView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeflurdyView Answer on Stackoverflow
Solution 4 - Visual Studio-CodeMarinaView Answer on Stackoverflow
Solution 5 - Visual Studio-CodeBalaji RavichandranView Answer on Stackoverflow
Solution 6 - Visual Studio-Codeuser3133925View Answer on Stackoverflow
Solution 7 - Visual Studio-CodelavaView Answer on Stackoverflow
Solution 8 - Visual Studio-CodeSaher ElgendyView Answer on Stackoverflow
Solution 9 - Visual Studio-CodePET3RView Answer on Stackoverflow
Solution 10 - Visual Studio-CodeogelacinycView Answer on Stackoverflow
Solution 11 - Visual Studio-CodeAriel Alejandro WagnerView Answer on Stackoverflow
Solution 12 - Visual Studio-CodeAhmed OsmanView Answer on Stackoverflow
Solution 13 - Visual Studio-CodewisbuckyView Answer on Stackoverflow
Solution 14 - Visual Studio-CodeGaopingView Answer on Stackoverflow