visual-studio-codepowershell-core

Toggle between fullscreen editor and terminal in VS Code


As a Windows systems admin, I use PowerShell quite a lot. With the release of PS Core, and the implication that the ISE is dead, I've started to try to use VS Code as my day to day tool. One feature I'm missing from ISE is the ability to swap between the editor and the terminal in fullscreen. I usually kept ISE open and maximized, and used Ctrl+R to swap between editor and terminal as needed. I haven't found a way to maximize the terminal, and swap easily between terminal and editor. I know I can make the terminal take up most of the screen, but a) this still leaves about 2 lines of editor open at the top, and b) there doesn't seem to be an easy way to then maximize the editor. Is there a way to minic the ISE behaviour that I haven't found yet?


Solution

  • To toggle between a full screen editor and a nearly full screen terminal you can use:

    {
        "key": "ctrl+alt+m",
        "command": "workbench.action.toggleMaximizedPanel"
    }
    

    with your keybinding of choice to replace the Ctrl-Alt-m : that is mine. You just need to "maximize" the terminal first - pull it up as far as it goes. It will remember that between sessions.


    Revisiting this :

    As of v1.38 this is now pretty simple. There are two commands that will toggle the panel/editors to full screen.

    Pick some keybinding to use for the toggle trigger:

    {
        "key": "ctrl+alt+q",
        "command": "workbench.action.toggleMaximizedPanel",
        // "command": "workbench.action.toggleEditorVisibility"  either one
        "when": "!terminalFocus"
    },
    

    The above will expand the panel or editor to full height, but toggling back will return the panel to its original size but not to nothing. If you want the terminal to bounce between full open and full closed try both of these keybindings:

    {
      "key": "ctrl+alt+t",  // you could use     "key": "ctrl+`",  if you wish
      "command": "workbench.action.closePanel",
      // "when": "terminalFocus"
    },
    {
      "key": "ctrl+alt+t",
      "command": "workbench.action.toggleMaximizedPanel",
      "when": "!terminalFocus"
    },
    

    The order of the above 2 keybindings is important.

    toggle terminal demo


    v1.50 is adding the setting panel.opensMaximized - I tried its different options but couldn't get a simpler result than the two keybindings ctrl+alt+t version I showed above. In any case, start with the panel closed for it to work well.