'VSCode: how to undo split screen and show just current file?

VSCode provides sweet shortcuts for manipulating (splitting and rearranging) screens:

  1. Press Ctrl + \ to split your screen in two.
  2. Press Ctrl + Number to focus on one of the screeens
  3. Press Ctrl + Shift + 0 to change vertical/horizontal split

However, how do I remove all the split screens and just show the currently focused one?

Example: say, I press Ctrl + \ two times (gives me three vertical screens), then press Ctrl + 2 to select middle screen. What should I press now to make left and right screen disappear and middle screen occupy the whole space? In Emacs, that would be Ctrl + X + 1.



Solution 1:[1]

See if this keybinding does what you want:

{
  "key": "alt+q",
  "command": "workbench.action.closeEditorsInOtherGroups"
}

There is no default keybinding for the command workbench.action.closeEditorsInOtherGroups so I made up that one. I think it accomplishes what you want. It will close the other editor groups and keep you at the focused group.

Solution 2:[2]

Invoke Command palette (pressing Ctrl + Shift + P by default) and type/search for:

View: Close Editors in Other Groups

Solution 3:[3]

I solved this by clicking on Application Menu (icon with 3 hor. lines on upper left) -> View -> Editor Layout -> Single. Hope it also works for you =).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mark
Solution 2 daGo
Solution 3 Angely Oyola Suárez