Toggling Between Fullscreen Editor and Terminal In VSCode

I've been a Vim user for decades however in recent years have largely switched to VS Code for the majority of my web development work. Because I simultaneously tend to spend a lot of time running various shell commands, the built-in terminal window remains perpetually open, and I'll regularly use the Ctrl-backtick keybinding to jump between the two.

Using the terminal in VS Code

However, when working exclusively from the laptop screen real estate can be tough to come by and so for these occasions I figured out how to toggle between the fullscreen editor and terminal. It's pretty easy to do and so I thought I'd pass along the tip.

Open the keyboard shortcuts in JSON mode and add the following entries:

  {
    "key": "shift+cmd+2",
    "command": "workbench.action.closePanel"
  },
  {
    "key": "shift+cmd+2",
    "command": "workbench.action.toggleMaximizedPanel",
    "when": "!terminalFocus"
  }

I've used shift+cmd+2 for the toggling shortcut, however you can switch this to whatever you'd like. If you're running Windows I suppose you would change the shortcut to shift-ctrl+2 or something like that. Once defined, save the changes and then try using the keyboard shortcut to switch between the two. With the terminal maximized your VS Code enviroment will look like this:

Using the terminal in VS Code

If you have any other VS Code screen optimization tips, I'd love to hear about them! Hit me up on Twitter at @wjgilmore.