Useful shortcuts for Visual Studio

Posted on 20th of July 2008

I’ve been using Visual Studio for quite some time now, but I’ve never really bothered to investigate this important tool too much. I’ve finally gotten around to check things out, and am I’m gonna try to learn some techniques to increase effieincy a little bit (almost seems like heresy). First round, I’ll focus on keyboard shortcuts. I’ve grouped them into 4 categories, navigation, debugging, editing and others, hopefully they are fairly explanatory. Now mind you that these are the default short cuts for Visual Studio for C#, for C++ and VB they may not work (you’ll have to customize the binding yourself).

Navigation

f12 Go to declaration
f7 Switch to code view (if applicable)
shift+f7 Switch to Switch to designer view (if applicable)
ctrl+i Incremental Search (only current document)
ctrl+shift+i Reverse incremental search (only current document)
ctrl+m,ctrl+m Toggle outline

Debug

f5 Run with debugging
shift+f5 Stop debugging
f10 Step over
f11 Step into
shift+f11 Step out
ctrl+f10 Run to cursor
f9 Toggle a breakpoint

Editing

ctrl+- Move to previous edit point (back)
ctrl+alt+i Switch to the Immediate window
ctrl+space Intellisense-menu
ctrl+k, ctrl+c Comment selection
ctrl+k, ctrl+u Uncomment selection
ctrl+shift+l Delete line
ctrl+. Resolve namespaces
ctrl+k,ctrl+f Prettify code
ctrl+k,ctrl+s Snippets (also around selection)

Other

ctrl+shift+b Build solution

 

Configuring shortcuts

I’m using a danish keyboard, so the ctrl+- shortcut does not work for me for whatever reason. You can customize your shortcuts by going Tools -> Customize -> Keyboard … Which brings you to the following dialog.

Visual Studio keyboard customization dialog

Visual Studio keyboard customization dialog

You’ll need to locate the shortcut your want to configure first (and there’s loads). Type in “back” into the “Show commands containing:”. You should find “View.NavigateBackwards” a bit down the last. You can bind it to something else, I use ctrl+ยด, but whatever works for you.

Other shortcuts

As you can see from the list, the amount of bindable actions is very large, and as far as I know not documented at all. Further, they also assume a US keyboard layout (and despite of old faithfull , I’m currently on a Danish keyboard, as it just does make some things easier). But that said, Coding Horror has a great script that will enumerate all of the short cuts, their name, and what object they belong to (View, Edit, etc). Microsoft also has some great looking posters for VB, C# and C++

But since those aren’t editable, and I’m just not sure I need that many short cuts, I’ve compiled my own little Word document I’ll print out, and also list my own bindings in.

Tags: , ,

Leave a Reply