My Visual Studio 2008 Favorite Shortcuts and Macros

When I’m programming I spend most of my time in the code editor. I need a powerful IDE with toons of tools, macros and customizations, but first of all a minimalist interface.

I close all toolbars leaving just the top Menu, no toolbars, no tool windows open by default. I have to make that change with every designer. I also remove the Navigation Bar (Tools -> Options -> Text Editor -> All Languages) this speeds up Visual Studio (I don’t know why but is a lot more faster).

In Visual Studio i’m using the following shorcuts and macros to have the minimal user interface tools at any given time:

To select an open Tool Window: Ctrl + Tab
To hide a Tool Window: Shift + Esc

To show the Solution Explorer: Ctrl + Alt + L
To hide the Solution Explorer: Shift + Esc (When is selected, otherwise you can press Ctrl + Alt + L to select it, or Ctrl + Tab to get the Solution Explorer Window Active)

If you want that your shorcuts act as a toogle commands you can create a Macro like this:

Sub ToggleSolutionExplorer()
  Dim w1 As Window = DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer)
If w1.Visible Then
     w1.Visible = False
     w1.Visible = True
    End If
End Sub


This way you can use the same shorcut to display or hide the tool window. Anyway I find best to use the standard command to show the window that you want to close and then use Shift + Esc. That way you have the same command to close windows and in the worse case you have to to two commands to close a window that isn’t selected, but is easier to remember standard commands.

More shorcuts:

Command Window: Ctrl + Alt + A
Class View: Ctrl + Shift + C
Properties: F4
Error List: Ctrl + |, Ctrl + E (and then F8 to navigate fordward within the list and the code)
Comment Code: Ctrl + K, C
Uncomment Code: Ctrl + K, U
Ctrl-PgUp/PgDn cycles between markup/designer/split views.
F7/Shift F7 cycles between designer view and code view. 

Another very useful macro and shorcut that I use is Macros.Samples.Accessibility.DecreaseTextEditorFontSize and Macros.Samples.Accessibility.IncreaseTextEditorFontSize. It’s very handy when you are browsing code, when you show code to other colleagues or when you are projecting your code. My mapping is:

DecreaseTextEditorFontSize: Ctrl + “Num-”
IncreaseTextEditorFontSize: Ctrl + “Num+”


Visual Studio .NET Shortcuts for Toggling Tool Windows by Kevin McFarlane
New Window Management Features for Visual Studio 2005 by Sara Ford


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s