Trying to find the equivalent to Ctrl + Shift + - in Intellij that collapses/expands all functions.
Asked
Active
Viewed 1.6e+01k times
194
-
3Possible duplicate of [How do I collapse sections of code in Visual Studio Code for Windows](http://stackoverflow.com/questions/30067767/how-do-i-collapse-sections-of-code-in-visual-studio-code-for-windows) – Jevgeni Geurtsen Sep 27 '16 at 07:29
5 Answers
343
Here it is.
Ctrl+Shift+[ Fold (collapse) region editor.fold
Ctrl+Shift+] Unfold (uncollapse) region editor.unfold
Ctrl+K Ctrl+[ Fold (collapse) all subregions editor.foldRecursively
Ctrl+K Ctrl+] Unfold (uncollapse) all subregions editor.unfoldRecursively
Ctrl+K Ctrl+0 Fold (collapse) all regions editor.foldAll
Ctrl+K Ctrl+J Unfold (uncollapse) all regions
Take Look at Visual studio Code Keybindings section at this link.
Also Platform specific Key board shortcuts available in pdf.here is the links
Jagadeesh Govindaraj
- 5,767
- 6
- 30
- 51
-
5This may have a conflict with the Vim plugin. Mentioning in case folks come here and scratch their head why it seems not to work. The Vim plugin is extremely bad about Ctrl-key sequences and MSoft could care less. – jatal Jun 02 '18 at 23:16
-
-
1Nice, and for Mac users, all same, just in place of `Ctrl` use `⌘ (Command)` – kishore Jun 03 '21 at 12:55
-
4Yes, it makes sense to make Ctrl+K+zero and Ctrl+K+J a pair of commonly used key bindings. Very wise to make them completely forgettable and bizarre. Well done Microsoft. Looking forward to not being able to install Windows 11. – Dan Rayson Jun 29 '21 at 13:47
41
You can set custom values for that.
- Open the Command Palette (⌘ + ⇧ + P or F1 on Mac)
- Search
Open Keyboard Shortcuts - Then search for
collapse - Finally click the + sign near the
Collapse AllandCollapse Folders in Exploreroptions and set the shortcuts like I did
Or you can open keybindings.json file and add this to the main array.
,
{
"key": "cmd+k cmd+s",
"command": "search.action.collapseSearchResults"
},
{
"key": "cmd+k cmd+e",
"command": "workbench.files.action.collapseExplorerFolders"
}
Nordle
- 2,698
- 3
- 12
- 32
Ahmad Awais
- 28,567
- 4
- 71
- 55
27
Go to File --> Preferences --> Keyboard Shortcuts (or Ctrl+K Ctrl+S)
Search for the word fold all
The ones you need are:
- Fold All
- Unfold All
Set your custom keyboard shortcut
Stefanos Kargas
- 9,683
- 21
- 74
- 98
11
One simple way I use is:
- Launch command pallete with Ctrl + Shift + P
- Search for
Collapse Folders in Explorer - Press Enter
You can also define a custom shortcut for this command in settings.
Luis Felipe
- 111
- 1
- 4
-
Thanks this was helpful, a recent update has made all of my folders expand when I first open VS Code, which is less than ideal. This makes it easy to close them all. – Karl Carpenter Oct 14 '21 at 13:01
1
Go to 'Keyboard Shortcuts' and type in search input: "fold all regions". You see fold/unfold (expand/collapse) commands and shortcuts. Use or change them.
Alexander
- 11
- 2