Last updated: Apr 6, 2024
Reading time·5 min
To hide or show the Sidebar in VS Code:
Ctrl
+ B
on Windows and LinuxCmd
+ B
on macOS.The keyboard shortcut toggles the sidebar:
You can view the Toggle Sidebar Visibility keyboard shortcut in this section of the docs.
If you hover over the key combination, information for Windows, macOS and Linux is displayed.
You can also click on View in the top menu, hover over Appearance and select if the Primary Sidebar should be shown or hidden.
Alt
key to show the top menu on Windows and Linux.I've also written an article on how to hide or show the minimap in VS Code.
There is also an icon in the top bar that allows you to toggle the sidebar.
Here is a short clip that demonstrates using the icon.
The activity bar is to the left of the sidebar (where the icons are displayed).
If you need to hide or show the Activity Bar:
Ctrl
+ Shift
+ P
(or Command
+ Shift
+ P
on macOS).F1
to open the Command Palette.You can also right-click on the Activity bar and select Hide Activity Bar to hide it.
Alternatively, you can use the top menu to hide or show the Activity Bar:
Click on View -> Appearance and then Activity Bar.
Alt
to show the top menu on Windows and Linux.If you want to set a different keyboard shortcut for the Toggle Sidebar Visibility action:
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.Enter
to confirm.If you need to set a keyboard shortcut for hiding or showing the Activity Bar, type toggle activity in the search field and double-click on View: Toggle Activity Bar Visibility.
You can also click on the plus icon, specify your preferred key combination and
press Enter
.
If the Ctrl
+ B
keyboard shortcut may be overridden by VIM or another
extension.
You can also set the keyboard shortcut directly in your settings.json file if you want to enforce it.
The name of the command is workbench.action.toggleActivityBarVisibility
.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.keybindings.json
file.{ "key": "ctrl+b", "command": "workbench.action.toggleSidebarVisibility" },
You can also set the keyboard shortcut to cmd+b
if you are on macOS.
You can also set the visibility of the activity bar globally, in a
settings.json
file.
Ctrl
+ Shift
+ P
(or Command
+ Shift
+ P
on macOS).F1
to open the Command Palette.Type user settings json.
Click on Preferences: Open User Settings (JSON)
"workbench.activityBar.visible": false
If the property is set to false
, the activity bar is hidden.
If you want to show the activity bar, set the property to true
.
"workbench.activityBar.visible": true
You can also hide or show the activity bar for the specific project, in a local
settings.json
file:
In the root directory of your project, create a .vscode folder.
Create a settings.json
file in the .vscode
folder.
Add the following code to your settings.json
file.
{ "workbench.activityBar.visible": true }
If you want to hide the activity bar, set the property to false
.
{ "workbench.activityBar.visible": false }
If you need to hide specific files or folders from the left sidebar, click on the following link.
You can learn more about the related topics by checking out the following tutorials: