Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attach a keyboard shortcut to 'Collapse All' items in solution explorer with Visual Studio 2012

Tags:

Like I said in the title of this question, is it possible to attach a keyboard shortcut to collapse all items in the solution explorer with Visual Studio 2012?

In previous version; 2010, I was able to create a macro to enable this feature but in Visual Studio 2012, there is no more support for macros.

I'm able to right click onto item in the solution explorer and choose 'Collapse All' but I prefer to just typed 'Ctrl+Shift+C' to do the same job.

like image 439
Samuel Avatar asked Sep 24 '12 15:09

Samuel


People also ask

What is the shortcut to collapse all functions in Visual Studio?

CTRL + M + O will collapse all.

How do I assign keyboard shortcuts in Visual Studio?

On the menu bar, choose Tools > Options. Expand Environment, and then choose Keyboard. Optional: Filter the list of commands by entering all or part of the name of the command, without spaces, in the Show commands containing box. In the list, choose the command to which you want to assign a keyboard shortcut.

How do I collapse code in Visual Studio?

(Ctrl+M, Ctrl+H) - Collapses a selected block of code that would not normally be available for outlining, for example an if block. To remove the custom region, use Stop Hiding Current (or Ctrl+M, Ctrl+U). Not available in Visual Basic.


3 Answers

FWIW, this is the best I've been able to come up with so far.

Alternative 1

  1. Press Ctrl+¨ to put focus in the search box above the Solution Explorer.
  2. Press Shift+Tab to move focus to the toolbar.
  3. Use the left arrow to move focus to the left, until you hit the Collapse All button (four times. YMMV).

Alternative 2

  1. Press Ctrl+Alt+l (or whatever your personal shortcut is) to focus the Solution Explorer.
  2. Press Shift+Alt to focus the Solution Explorer toolbar. This puts the focus on the Home button on the toolbar.
  3. Use the right arrow to move focus to the right, until you hit the Collapse All button (three times).
  4. Press Enter.

Alternative 3

  1. Press Ctrl+Alt+l (or whatever your personal shortcut is) to focus the Solution Explorer.
  2. Press and hold the left arrow until you've reached the top node (the Solution node).
  3. Press the up arrow to put focus in the search box above the Solution Explorer.
  4. Press Shift+Tab to move focus to the toolbar.
  5. Use the left arrow to move focus to the left, until you hit the Collapse All button (two times. YMMV).
like image 130
Mark Seemann Avatar answered Oct 17 '22 02:10

Mark Seemann


As you can see in the screenshot below, there is an option called Collapse All and a shortcut key next to it.

enter image description here

Now this shortcut key will not work for you !

Unless ofcourse, you set it up using Tools > Options > Keyboard. The command name is CollapseInSolutionExplorerAction. Search using this command name and assign a shortcut key of your choice.

enter image description here

That's it and you are ready to use your shortcut key !

Source

like image 40
Yasser Shaikh Avatar answered Oct 17 '22 00:10

Yasser Shaikh


Visual Studio 2012 / ReSharper 8.0.1:

The command is 'ProjectAndSolutionContextMenus.Project.ReSharper_CollapseInSolutionExplorer'.

like image 30
John le Conte Avatar answered Oct 17 '22 00:10

John le Conte