问题
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.
回答1:
FWIW, this is the best I've been able to come up with so far.
Alternative 1
- Press Ctrl+¨ to put focus in the search box above the Solution Explorer.
- Press Shift+Tab to move focus to the toolbar.
- Use the left arrow to move focus to the left, until you hit the Collapse All button (four times. YMMV).
Alternative 2
- Press Ctrl+Alt+l (or whatever your personal shortcut is) to focus the Solution Explorer.
- Press Shift+Alt to focus the Solution Explorer toolbar. This puts the focus on the Home button on the toolbar.
- Use the right arrow to move focus to the right, until you hit the Collapse All button (three times).
- Press Enter.
Alternative 3
- Press Ctrl+Alt+l (or whatever your personal shortcut is) to focus the Solution Explorer.
- Press and hold the left arrow until you've reached the top node (the Solution node).
- Press the up arrow to put focus in the search box above the Solution Explorer.
- Press Shift+Tab to move focus to the toolbar.
- Use the left arrow to move focus to the left, until you hit the Collapse All button (two times. YMMV).
回答2:
As you can see in the screenshot below, there is an option called Collapse All and a shortcut key next to it.
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.
That's it and you are ready to use your shortcut key !
Source
回答3:
Visual Studio 2012 / ReSharper 8.0.1:
The command is 'ProjectAndSolutionContextMenus.Project.ReSharper_CollapseInSolutionExplorer'.
回答4:
I suggest you to try CodeMaid extension for Visual Studio. It provides a command "Collapse All Projects Recursively" that has customizable shortcut (by default, it is Ctrl+M,-). It has some other nice abilities, like switching between .cpp and its .h files, joining lines, etc.
回答5:
I have searched on the net a way to do this when I have first install VS2012 ..
I have just found the solution, so I share it :)
you can do this by adding your visual studio version to an existing Extension ...
- Download the extension for VS 10
- Change the extension from vsix to zip
- extract it and open the file extension.vsixmanifest
Find this xml section : SupportedProducts Add this :
<VisualStudio Version="11.0"> <Edition>Ultimate</Edition> <Edition>Premium</Edition> <Edition>Pro</Edition> </VisualStudio>
you can also try version 12 for visual studio 2013 ...
zip it, and change the extension from zip to vsix.
Now you can Install it.
after install it, Goto Tools -> Customise and click on the keyboard button.
Search "CrossProjectMultiProject.CollapseProjects" and assing the shortcut you like.
Have a nice codding. Please +1 if this help you
ps. sorry for my bad English, im French ;-)
来源:https://stackoverflow.com/questions/12568114/attach-a-keyboard-shortcut-to-collapse-all-items-in-solution-explorer-with-vis