How do you unsplit an editor, go back from 2 code views to 1, same with terminal

Visual Studio-Code

Visual Studio-Code Problem Overview


How do you unsplit an editor, go back from 2 code views to 1, same with terminal.

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

Editor Groups

To "unsplit" editor groups without closing any open files, use the menu-bars: View > Editor Layout > Single (or, while in the editor, press and release ALT and then type vls).

Editor groups are also closed by default when they become empty. You can empty an editor group by closing tabs/files or by dragging all of the tabs from that group to another.

Hints:

  • Grabbing the area to the right of the tabs allows you to drag/drop all tabs in a group at once.
  • The "Open Editors" section of the "Explorer" panel lets you use CTRL and SHIFT to select and drag/close multiple editors at once. (If you don't have an "Open Editors" section, use the "..." menu of the Explorer panel to enable it.)

Terminal Groups

Terminals work differently than editor groups and are more limited:

You can open new terminal groups by pressing the '+' icon in the terminal tab of the panel.

"Splitting" a terminal (done by clicking the split icon in the terminal tab of the panel) really just opens an additional terminal in the same group and displays it side-by-side with the others in the group.

So, two ways to "unsplit" terminals:

  • Kill terminals (e.g. with the trashcan icon) until there is only one left in the group.
  • Switch to a new terminal group with only a single terminal in it.

(as of Visual Studio Code version 1.29.1)

Solution 2 - Visual Studio-Code

By mouse

To close or unsplit a split Editor you need to

  • either close all the tabs in the split side you want to close
  • or right-click on one of the tabs in the section you want to close and select Close All.

By keyboard To close or unsplit split Terminals:

type exit in the terminal you want to close.

Note

The split Editors will not close when you close the tabs if you have in your settings "workbench.editor.closeEmptyGroup" : false

Solution 3 - Visual Studio-Code

Editors:

View: Join Editor Group with Next Group workbench.action.joinTwoGroups

View: Join All Editor Groups workbench.action.joinAllGroups

Terminal:

Terminal: Kill the Active Terminal Instance workbench.action.terminal.kill

Solution 4 - Visual Studio-Code

ctrl+\ to split ctrl+w to unsplit

Solution 5 - Visual Studio-Code

F1 > View: Join Editors of Two Groups

Solution 6 - Visual Studio-Code

Default keybindungs for join/split editor (macOS)

join current view/group with next group (just press multiple times if you have multiple groups):

alt+cmd+1

split current view/group:

alt+cmd+2

Solution 7 - Visual Studio-Code

To avoid this "VSCode irritation no. 1", you also have, beside "View: Join Editor Group with Next Group", a way to avoid the issue entirely, with VSCode 1.52 (Nov. 2020)

> ## New setting to disable editor group splitting on drag & drop

> A new setting workbench.editor.splitOnDragAndDrop allows to disable editor group splitting when using drag & drop of editors. > > There is also a way to toggle this conditionally during the drag and drop operation when you press and hold Shift key (macOS) or Alt key (Windows, Linux).

Solution 8 - Visual Studio-Code

Split current file (Ctrl+\) is a combination I can constantly hitting by mistake so I just removed the shortcut.

  1. Command Palette

  2. Preferences: Open Keyboard Shortcuts (JSON)

  3. Paste the following object in the array:

    { "key": "ctrl+oem_5", "command": "-workbench.action.splitEditor" }

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
QuestionTyler OlthuizenView Question on Stackoverflow
Solution 1 - Visual Studio-CodeteichertView Answer on Stackoverflow
Solution 2 - Visual Studio-CodealfredoView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeAlexView Answer on Stackoverflow
Solution 4 - Visual Studio-CodeDeculaView Answer on Stackoverflow
Solution 5 - Visual Studio-CodeJessicaView Answer on Stackoverflow
Solution 6 - Visual Studio-CodescsskidView Answer on Stackoverflow
Solution 7 - Visual Studio-CodeVonCView Answer on Stackoverflow
Solution 8 - Visual Studio-CodeRobulaView Answer on Stackoverflow