Is there a way to resize the sidebar with a hotkey? For example, I currently have the "workbench.action.decreaseViewWidth"
command bound to a key. But it appears that there is not a "workbench.action.decreaseSidebarWidth"
command.
I have done this which works well for me. Add this to your "keybindings.json". I have Swedish keyboard layout, so you might need to change the "key" part.
{
"command": "runCommands",
"key": "alt+[ArrowLeft]", // whatever keybinding
"args": {
"commands": [
// commands to run in sequence
"workbench.files.action.focusSideBar",
"workbench.action.decreaseViewSize"
]
}
},
{
"command": "runCommands",
"key": "alt+[ArrowRight]", // whatever keybinding
"args": {
"commands": [
// commands to run in sequence
"workbench.files.action.focusSideBar",
"workbench.action.increaseViewSize"
]
}
}
I've found the following to be a simple, successful mix of the previous answers. I've added additional instructions for those unfamiliar with keyboard shortcuts:
Open "Preferences: Open Keyboard Shortcuts (JSON)".
Add these entries to the JSON:
{
"key": "ctrl+alt+[ArrowLeft]",
"command": "workbench.action.increaseViewSize"
},
{
"key": "ctrl+alt+[ArrowRight]",
"command": "workbench.action.decreaseViewSize"
},
Save changes.
Press ctrl/control (^) and alt/option key (⎇) and left arrow (←).
Verify sidebar decreases in size.
Press ctrl/control (^) and alt/option key (⎇) and right arrow (→).
Verify sidebar increases in size.
If your primary sidebar is on the right, consider swapping the commands in the shortcuts you add.
✅ Benefits:
runCommands
)⚠️ Cons:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With