Note: these shortcuts only work as expected if you edit your keybindings.json
I wasn't happy with the default shortcuts, I wanted them to work as follow:
- Fold: Ctrl + Alt + [
- Fold recursively: Ctrl + ⇧ Shift + Alt + [
- Fold all: Ctrl + k then Ctrl + [
- Unfold: Ctrl + Alt + ]
- Unfold recursively: Ctrl + ⇧ Shift + Alt + ]
- Unfold all: Ctrl + k then Ctrl + ]
To set it up:
- Open
Preferences: Open Keyboard Shortcuts (JSON)(Ctrl + ⇧ Shift + p) - Add the following snippet to that file
Already have custom keybindings for fold/unfold? Then you'd need to replace them.
{ "key": "ctrl+alt+[", "command": "editor.fold", "when": "editorTextFocus && foldingEnabled" }, { "key": "ctrl+alt+]", "command": "editor.unfold", "when": "editorTextFocus && foldingEnabled" }, { "key": "ctrl+shift+alt+[", "command": "editor.foldRecursively", "when": "editorTextFocus && foldingEnabled" }, { "key": "ctrl+shift+alt+]", "command": "editor.unfoldRecursively", "when": "editorTextFocus && foldingEnabled" }, { "key": "ctrl+k ctrl+[", "command": "-editor.foldAll", "when": "editorTextFocus && foldingEnabled" }, { "key": "ctrl+k ctrl+]", "command": "editor.unfoldAll", "when": "editorTextFocus && foldingEnabled" },