Search code examples
visual-studio-code

How can I temporarily maximize an editor group in VS Code?


I like the split view mode in VS Code but one thing I can't figure out is how to maximize a split view temporarily.

I would like to be able to maximize a split window (as in on one of the windows of a split) for a moment and then restore the layout when I am done with it.


Solution

  • It looks like v1.84 (October 2023) will have a new command for toggling the maximization of the current editor group which appears to be exactly what you want:

    workbench.action.toggleMaximizeEditorGroup
    
    "View: Toggle Maximize Editor Group"
    

    Bound by default to Ctrl+K Ctrl+M

    See Commit: Add editor group maximize toggle action. Available in the Insiders Build now.

    demo of toggling maximize the focused group

    There is a new command View: Toggle Maximize Editor Group (kb(workbench.action.toggleMaximizeEditorGroup)) to maximize an editor group. This will hide all other groups and adds a button to the tab bar, allowing the user to restore the previous layout. When changing the setting workbench.editor.doubleClickTabToToggleEditorGroupSizes to maximize, users can double-click on an editor tab to maximize and unmaximize the editor group.

    Also note that part of this v1.84 update is the REMOVAL of the older commands:

    View: Maximize Editor Group
    View: Unmaximize Editor Group
    

    v1.38 has a new command:

    workbench.action.toggleEditorWidths
    

    which can be useful here. It is unbound to a keybinding by default.

    Say you bind it like so:

    {
        "key": "ctrl+alt+b",
        "command": "workbench.action.toggleEditorWidths"
    }
    

    Then use it once to maximize one of the splits - after that switching focus to either one will maximize that one easily. Basically, using the workbench.action.toggleEditorWidths command once will do the work of manually dragging the separator bar for you.


    Before v1.38

    From the July 2018 Release Notes: Automated maximize of minimized editors.

    To get this to work you have to first manually minimize one of the splits (or editors in an editor group).

    Drag the separator bar between the editors as far left (or right) as it will go.

    Or use the command View: Maximize Editor Group.

    Then clicking in or otherwise focussing (perhaps with workbench.action.focusLeftGroup or similar) the other split will maximize it.

    Note: You can always maximize the active editor via View: Maximize Editor Group (workbench.action.minimizeOtherEditors) or reset all editor sizes via View: Reset Editor Group Sizes (workbench.action.evenEditorWidths).