Is there a shortcut key in Visual Studio that will minimize all of the regions or + signs so that I don't have to go through and click each one individually?
Asked
Active
Viewed 4.0k times
54
-
3How to collapse **regions** is actually not clearly answered in any of these answers nor on the linked question. Pressing (Ctrl+M, Ctrl+O) will **toggle** between collapsed or expanded state, not just 'expand all' – Raikol Amaro Oct 30 '18 at 19:34
3 Answers
91
C-m, C-o // collapse all
C-m, C-l // expand all
C-m, C-m // collapse, expand one
Where C is short for Ctrl. You can find more shortcuts at the msdn site
You can find the commands by going to Keyboard Options under the Tools menu, they are mapped to these commands
- Edit.CollapseToDefinitions (
C-m, C-o), - Edit.ToggleOutliningExpansion (
C-m, C-m) and - Edit.ToggleAllOutlining (
C-m, C-l)
If you are using Visual Studio Code the commands are similar but work differently. The commands are roughly these
C-k 2- Fold Level 2C-k C-j- Unfold allC-k [- Unfold recursively (unfold where the caret is)
You can search for Fold or Unfold commands (using C-S-p) to find all of them.
Patrick
- 17,669
- 6
- 70
- 85
-
To collapse actual #regions press **(Ctrl+M, Ctrl+L)** once or twice. Visual Studio 2017 – Raikol Amaro Oct 30 '18 at 19:20
51
- Ctrl + M,M - expand/collapse at caret
- Ctrl + M,O - collapse all in document
- Ctrl + M,L - expand all in document
Drew Noakes
- 300,895
- 165
- 679
- 742
6
Ctrl + M, Ctrl + M
You can perform this on a selection too.
Jasper
- 2,166
- 4
- 30
- 50
Gerrie Schenck
- 22,148
- 20
- 68
- 95
-
1This will only minimize *one* region though, not all of them at the same time – Patrick Nov 12 '10 at 13:58
