Visual Studio 2010 Essential Keyboard Shortcuts

By | April 8, 2010

One of the things that separates great coders from ok coders is their use of the keyboard. You code by typing; moving your hands away from the keyboard to the mouse to find the pointer, position the pointer, and click on what action you want is time better spent pressing the right key combination to effect the same thing. I’m going to list the keyboard shortcuts I feel are the most essential to efficient coding, from a back-end coder perspective.


  1. Touch typing. If you can’t do this, learn it first – there are scads of online resources for this. Spending brain cycles remembering where keys are is probably one of the most inefficient ways to code. All it takes is 15 minutes a day, and in 2 months you’ll have improved your efficiency by at least 25%. Really.
  2. Two monitors. This isn’t as important as touch typing, above, but really close. Jeff Atwood has the classic post regarding the need for at least 2 monitors for any self-respecting coder, and has recently upped the ante to 3.
  3. Visual Studio 2010. It’s only RC at time of this writing, but is being released in 5 days, so yeah. The detachable source code tab feature simply rocks, and this alone has improved my efficiency by at least 5.298%.
  4. Test Driven.NET 3.0+. My shop uses this in conjunction with NUnit to do our test driven development. You could use other tools, as long as they allow you to run unit tests contextually from the IDE and allow you
  5. WinSplit Revolution. Learn the basic shortcuts of this tool and your multi-monitor ninja factor increases tenfold. You can wow your fellow coders as you zip windows left, right, up, and down with just a press of three keys.

Custom Visual Studio 2010 Key Mappings

You’ll need to do some custom mappings before we can start playing. Doing this in Visual Studio 2010 is cake. We’ll start by mapping the “detach source code tab” function.

  • Start by going to Tools –> Options.

4-7-2010 9-42-53 PM

  • Click on the Keyboard option in the Environment node.

4-7-2010 9-46-30 PM

  • Type “float” in the “Show commands containing” box, and select Window.Float.

4-7-2010 9-56-30 PM

  • Press the keyboard combination that you want to use to detach a code tab. I use CTRL+Q, since I never really use the run selection option. Once you’ve picked your shortcut, click Assign. Clicking OK first will not assign the shortcut to the command.

4-7-2010 9-58-21 PM

Next you’ll want to map the re-docking of a floating code tab. Look for Window.Dock for this mapping.

Finally, there are the test execution shortcuts. You’ll want to map both the run test command and the run test with debugging command. You can find the first command by looking for TestDriven.NET.RunTests, and the second by looking for TestDriven.NET.RerunWithDebugger. I use CTRL+R, CTRL+R for run test, and CTRL+R, CTRL+D for run test with debugging.

Unleash the Keyboard Shortcuts!

Window Navigation Keyboard Shortcuts

Now for the fun. Pop open your current solution, and press CTRL+TAB and hold the CTRL key. Now use the arrow keys to navigate around the currently open windows, as well as the active tool windows. Need to open a file? Arrow to the solution explorer and press ENTER. Now use the arrow keys (or page up/page down) to find the file you need and press enter. When you’re done with the file, press CTRL+F4 to close it.

Definition Navigation Keyboard Shortcuts

Highlight a method or variable and press F12 to navigate to its definition. Once you’re done spelunking, press CTRL+- to navigate back to where you started from.

Text Navigation Keyboard Shortcuts

Use CTRL+arrows (left or right) to skip along the current line following word boundaries. Use CTRL+Home or CTRL+End to quickly jump to the beginning or end of a file, respectively. Use CTRL+SHIFT instead of just CTRL for the above combinations to select from your current point to where you jump to for quick replacement or selection.

Debugging & Keyboard Shortcuts

The combination I’ve grown to love uses all of the above, in addition to the custom mappings. When doing TDD, you write your test first, then code to make the test pass. This works great with two monitors; you have the test on one side, and the code under test on the other. So, CTRL+TAB and arrow to the file you want to test. Then float the code window using CTRL+Q (or whatever custom mapping you selected) and use WinSplit Revolution to send it to the other screen, maximized. Then open the test class file the same way, leaving it docked in the IDE. The CTRL+TAB shortcut automatically switches you to the last used code window first, so you can quickly switch back and worth between your test on one screen and your class under test on the other. As you work your way to green, use CTRL+R+R to run your test. Once you’re done, CTRL+F4 to close each file down.

It takes some getting used to, but once you master your keyboard at a subconscious level, you free yourself from thinking about where the keys are and have more time to think about your domain. Try it out, and if you’re not satisfied, I’ll send you your money back.