Thursday, February 7, 2008

Keyboard Shortcut (organize usings)

As I mentioned in the post yesterday, having a way to remove unnecessary "using" statements and to sort them quickly is a great feature in Visual Studio 2008. But as a developer having to move your hand to the mouse wastes precious time, why not setup a keyboard shortcut?

It is simple to setup this shortcut, just open up VS and go to Tools -> Options. Expand the "Environment" tree and select "Keyboard" (see image below). The command name for reorganizing and removing the using statements is "Edit.RemoveAndSort". Start typing that in the "Show commands containing:" text box and select it when you see it in the list. Now click in the "Press shortcut keys" text box and press your shortcut combination. If this combination is already used for something else it will say that in the "Shortcut currently used by" text field. When you enter the shortcut you want to keep, click OK.

0 comments: