Visual Studio Code 1.24.1 Toggle Maximize Panel (Terminal) Keybinding Shortcut

In Visual Studio Code 1.24.1. on macOS, the keybinding to toggle the visibility of the Panel (Problems, Output, Debug Console and Terminal) is Command + J, this is really handy. But if you have a widescreen monitor  and you like keeping the panel open at all times with the terminal, for example, it would be better to be able to toggle the size (width) of the panel.

This keybinding doesn’t exists, after googling a bit I found a closed request for it [Request] Allow a keybinding for “Maximize/Restore panel size” in the terminal panel. #33040 where Daniel Imms (Tyriar on Github) hinted how to accomplish this. As a newbie to Visual Studio Code, it wasn’t obvious to me. Fortunately, the explanation on Key Bindings for Visual Studio Code page was simple:

First, go to the Keyboard Shortcuts editor, on macOS the menu sequence is Code > Preferences > Keyboard Shortcuts, or you can alternatively hit Command K + S. This will open a Keyboard Shortcuts, you can’t directly add a new keybinding here, instead click on the keybindings.json link on top of it and the tab will split vertically showing at the bottom the keybindings.json file.

Here you have to options, directly edit the JSON file or use the Define Keybinding option either clicking on the button at the bottom right or using the shortcut Command K + K.  Once you are done it should be something like:

// Place your key bindings in this file to overwrite the defaults
  "key": "alt+cmd+;",
  "command": "workbench.action.toggleMaximizedPanel"

Save it and you should be all set. Your keybinding will toggle the panel between it “normal” size and a maximized width that should allow you to comfortably read any large output in the panel view.

The original snippet of keybinding configuration generated included a when  condition to constrain the shortcut to the editor window, if you give focus to the panel, let’s say you want to copy some output from the terminal, then you won’t be able to toggle the view again unless you come back to the text editor. I removed it and now it work as intended.

Leave a reply:

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Site Footer