It'd be handy if there was a keyboard shortcut for hiding and showing the sidebar. Sublime has cmd+k+b and it's a quick way of gaining some screen real estate when you need it. Anybody know if this exists or if the user can add it manually to VS Code?
12 Answers
The command can be triggered via Ctrl+B on Windows and Linux or Cmd+B on the Mac.

- 6,075
- 12
- 66
- 96

- 113,622
- 14
- 75
- 54
-
18if the sidebar is where the files are shown, what do you call the one with the four buttons ? How do you hide that one ? – Abderrahmane TAHRI JOUTI Apr 16 '16 at 21:22
-
3You cannot hide it. We call it the Activity Bar. – Benjamin Pasero Apr 18 '16 at 21:13
-
See: https://github.com/Microsoft/vscode/issues/1105 | from Xiltch: My Band-Aid was opening the developer tools every time I open the editor and deleting the parent div (ID: workbench.parts.activitybar ) – Helmut Granda Aug 17 '16 at 14:28
-
19@AbderrahmaneTAHRIJOUTI you can hide the activity bar by setting up your own keybinding (https://code.visualstudio.com/docs/customization/keybindings) for `workbench.action.toggleActivityBarVisibility` – rouan Feb 14 '17 at 09:14
-
1@rouan in the newer versions of Code, Right click > Hide Activity Bar does the work – Abderrahmane TAHRI JOUTI Feb 15 '17 at 10:53
-
2But keyboard shortcuts :) – rouan Feb 15 '17 at 14:34
-
There is a command called `workbench.action.toggleActivityBarVisibility` – Benjamin Pasero Feb 19 '17 at 08:14
-
6Right click on activity bar and hide it. – Triven Jul 31 '17 at 05:11
-
1And any suggestions on how to get focus on sidebar? (i.e. being able to navigate with buttons without selecting it with the mouse) – pkaramol Jan 15 '21 at 09:18
-
The Appearance, Primary Side Bar shows "CTRL-B" which doesn't even work. UI should be smart enough to not display things that don't work, better to show nothing. Such a major usability feature shouldn't require hacks that end up being different on every dev's machine. – AUSTX_RJL Aug 19 '22 at 15:08
-
@pkaramol Add a shortcut to workbench.explorer.fileView.focus – Nick Apr 12 '23 at 04:10
There are 3 bars on the side, 2 left and 1 right:
- the activity bar with 5 buttons
- the primary sidebar toggled by clicking any of the activity bar buttons.
- the minimap
All of these hotkeys and more (e.g. the terminal & output panel, Ctrl+J
) are now visible through the View (Alt-V) and View>Appearance menus:
The activity bar has no toggle hotkey by default, but you can assign one like this:
{
"key": "ctrl+alt+b",
"command": "workbench.action.toggleActivityBarVisibility"
},
Or hide completely with "workbench.activityBar.visible": false
The sidebar toggle hotkey is Ctrl+B by default, but may be overridden by e.g. vim plugin, here's how to enforce or change it:
{
"key": "ctrl+b",
"command": "workbench.action.toggleSidebarVisibility"
},
The minimap can be hidden with "editor.minimap.enabled": false
and toggled with editor.action.toggleMinimap
since vscode 1.16.
And with the Sidebar-activity toggler extension, so you toggle both activity and sidebar together with one key mapping to sidebar-activity-toggler.toggleSidebarAndActivityBar

- 4,236
- 3
- 25
- 32
-
1Its working fine. But one thing, "ctrl+shift+b" has already mapped to one action by default so first we need to remove/change that. – Ramasamy Kasi Dec 06 '18 at 07:03
-
Building on @RamasamyKasi's comment, you could map the new shortcut to `alt+b` instead, so it doesn't conflict with the existing *build task to run* shortcut. – Philippe Fanaro Aug 16 '19 at 13:23
-
@PhilippeFanaro `Alt+stuff` is usually for quick menu-bar access. For example Alt + any of FESVGDTH opens built-in menus, and I guess an extension could provide a "B" menu. Even if not, it breaks the mental model. Any other suggestion? – eddygeek Aug 27 '19 at 20:57
-
@eddygeek You're correct to point that out. But I guess that, given how many shortcuts exist by default, there aren't that many options when it comes to reserving key combinations. `Alt + Stuff` is one of the least used combinations --- except for other more foreign keys on the keyboard. The procedure I use nowadays is: `(1)` choose and `Alt + Stuff` combination; `(2)` Look for it on the default shortcuts, if there is no assignment, use it, otherwise try another `Alt + Stuff` combination. – Philippe Fanaro Aug 27 '19 at 22:10
-
3There is also the `Sidebar-activity toggler` extension, so you can map `ctrl+b` to `sidebar-activity-toggler.toggleSidebarAndActivityBar` to toggle visibility of the activity bar and the sidebar BOTH at the same time. – Nahuel Greco Nov 21 '20 at 01:59
-
-
To Hide the 5 button Activity Bar we can now:
View -> Hide Activity Bar
This is in vscode 1.9, not sure which version it was introduced in.

- 6,259
- 2
- 52
- 55
As Benjamin Pasero's answer states you can use:
Ctrl+B on Windows and Linux
⌘ Cmd+B on the Mac.
but sometimes you have another keyboard shortcut with ⌘ Cmd+B, in my case I had it to format some React code. To reverse that you can use the following:
Code > Preferences > Keyboard Shortcuts (⌘+K ⌘+S) then search for B and disable the other shortcut command.
You can also change the it and put which ever shortcut you want, just search for Toggle Side Bar Visibility like this:

- 8,525
- 5
- 47
- 53
-
1This is the only solution that worked for me in Markdown, which uses cmd+B as bold. – duality_ Jun 30 '20 at 19:16
Just in case you be intended for hiding the right lateral "sidebar", also called minimap, there is no shortcut. But you can configure the settings with:
{"editor.minimap.enabled: false"}

- 180
- 1
- 6
-
1I cannot remember when they added this minimap. They should really provide an option to hide that more directly. Its more annoying then helpful. – Jay Aug 24 '17 at 06:03
-
You find the settings in the left lower corner, the cog wheel. Took me some time traversing the menus before I noticed it was placed somewhere else. – Mike de Klerk Oct 17 '17 at 08:09
To hide/show the side bar:
Ctrl+B on Linux and Windows.
⌘ Cmd+B on Mac.

- 2,750
- 1
- 21
- 23
One can also hide the activity bar with the following setting in settings.json
:
"workbench.activityBar.visible": false

- 4,182
- 1
- 24
- 19
No need to edit Settings.json directly
Do the following:
- Open the Keyboard Shortcuts by pressing ctrl+k & ctrl+s
- Search: "Toggle Activity Bar Visibility"
- Enter the keyboard shortcut
- Done!

- 301
- 5
- 4
-
1"Toggle Activity Bar Visibility" is for thin icon sidebar bar only. For sidebar part with file tree view, try "Toggle Side Bar Visibility". Depends what you want. Thank you Orel, it helped me! – revelt Nov 13 '20 at 06:55
In the VS code version 1.43, you can hide or show the side menu or activity bar by going under the 'VIEW' tab in the nav bar in the top margin of VS CODE(called the 'Menu Bar'). Go to View => Appearance, there you can check or uncheck different nav bars to show/hide each one.
If you have the top bar (Menu Bar) currently hidden press 'alt' key to bring it back then follow above instructions to check it to keep it there permanently if desired.

- 195
- 2
- 12
No answer mentions this: to toggle the search bar that you open with cmd + shift + f
the command is ⌥ + cmd + b
alongside cmd + b
in case you intend to close all side bars (not including minimap and activity bar. Please refer to the other answers for that).

- 1,129
- 1
- 11
- 29