Ask anyone that knows me, and they will confirm that I hate the mouse. This isn’t because I deny affection to objects that don’t look like their mammalian-named self, but rather for a much more simple and not-insane reason: I have terrible eyesight.

Introduction

Thanks to a degenerative eye disease known as Choroideremia, I have learned to rely more on the keyboard which I can feel digital/static positions of keys relative to my fingers, than the much more analog/random position of the mouse. Now, I would like to share some of the keyboard shortcuts with you now, as I believe that they not only increase my productivity, but yours as well once you know them (if you don’t already of course)... I share one of my biggest tips for productivity in the conclusion at the end.

Visual Studio Key Shortcuts

Global Editor Shortcuts

These are shortcuts that are available from almost any application running in Windows, however are many times forgotten.

Shortcut

Action

Visual Studio 2010 Functionality

Ctrl + X

Cut

This shortcut works without a selection. If nothing is selected, the entire line that the caret is on is cut from the editor.

Ctrl + C

Copy

This shortcut works without a selection. If nothing is selected, the entire line that the caret is on is copied from the editor.

Ctrl + V

Paste

If you copied an entire line by the method above, the data is pasted in the line above the current caret line.

Ctrl + Shift + V

Next Clipboard Element

Cut/Copy multiple things, and then hit this combo repeatedly to switch to the next clipboard item when pasting.

Ctrl + Backspace

Delete Previous

Will delete the previous word from the editor directly before the caret. If anything is selected, will just delete that.

Ctrl + Del

Delete Next Word

Will delete the next word/space from the editor directly after the caret. If anything is selected, will just delete that.

Shift + Del

Delete Focused Line

Will delete the line from the editor that the caret is on. If something is selected, will just delete that.

Ctrl + ← or Ctrl + →

Left/Right by Word

This will move the caret left or right by word or special character boundary. Holding Shift will also select the word.

Ctrl + F

Quick Find

Either the Quick Find panel, or the search bar if you have the Productivity Power Tools installed.

Ctrl + Shift + F

Find in Solution

Opens up the 'Find in Files' window, allowing you to search your solution, as well as using regex for pattern matching.

F2

Rename File...

While not debugging, selecting a file in the solution explorer\navigator and pressing F2 allows you to rename the selected file.

Global Application Shortcuts

These are shortcuts that are available from almost any application running in Windows, however are many times forgotten... Again...

Shortcut

Action

Visual Studio 2010 Functionality

Ctrl + N

New File dialog

Opens up the 'New File' dialog to add a new file to the current directory in the Solution\Project.

Ctrl + O

Open File dialog

Opens up the 'Open File' dialog to open a file in the editor, not necessarily in the solution.

Ctrl + S

Save File dialog

Saves the currently focused editor tab back to your HDD/SSD.

Ctrl + Shift + S

Save All...

Quickly save all open/edited documents back to your disk.

Ctrl + Tab

Switch Panel\Tab

Tapping this combo switches between tabs quickly. Holding down Ctrl when hitting tab will bring up a chooser window.

Building Shortcuts

These are shortcuts that are focused on building and running a solution. These are not usable when the IDE is in Debug mode, as the shortcut changes by context.

Shortcut

Action

Visual Studio 2010 Functionality

Ctrl + Shift + B

Build Solution

Starts a build process on the solution according to the current build configuration manager settings.

Ctrl + Break

Cancel a Building Solution

Will cancel a build operation currently in progress. Good for long running builds when you think of one last change.

F5

Start Debugging

Will build the solution if needed and launch debugging according to the current configuration manager settings.

Ctrl + F5

Start Without Debugger

Will build the solution if needed and launch the startup project without attaching a debugger.

Debugging Shortcuts

These are shortcuts that are used when debugging a solution.

Shortcut

Action

Visual Studio 2010 Functionality

F5

Continue Execution

Continues execution of code until the next breakpoint.

Ctrl + Alt + Break

Pause Execution

Pauses the program execution.

Shift + F5

Stop Debugging

Stops the current debugging session. NOTE: Web apps will still continue processing after stopping the debugger. Keep this in mind if working on code such as credit card processing.

Ctrl + Shift + F5

Restart Debugging

Stops the current debugging session and restarts the debugging session from the beginning.

F9

Place Breakpoint

Toggles/Places a breakpoint in the editor on the current line. Set a breakpoint in condensed code by highlighting the statement first.

F10

Step Over Statement

When debugging, executes all code in methods/properties on the current line until the next line.

F11

Step Into Statement

When debugging, steps into a method call so you can walk through the code executed there (if available).

Ctrl + Alt + I

Immediate Window

Open the Immediate Window to execute commands when execution is paused.

Navigation Shortcuts

These are shortcuts that are used for navigating in the IDE or editor panel.

Shortcut

Action

Visual Studio 2010 Functionality

Ctrl + -

Navigate Back

Use this combination to navigate through what you've viewed backwards

Ctrl + Shift + -

Navigate Forward

Use this combination to navigate through what you've viewed forwards (after having gone back).

F4

Properties Panel

Opens the properties panel for the selected item in the editor/designer/solution navigator (context driven).

F12

Go to Definition

Press F12 with the caret on a member to navigate to its declaration. With the Productivity tools, Ctrl + Click works too.

Ctrl + KCtrl + T

View Call Hierarchy

View the call hierarchy of the member the caret is on. Great for going through n-tier solutions and interface implementations!

Ctrl + Alt + B

Breakpoint Window

View the breakpoint window to manage breakpoints and their advanced options. Allows easy toggling of breakpoints.

Ctrl + Alt + L

Solution Navigator

Open the solution explorer panel.

Ctrl + Alt + O

Output Window

View the output window to see build\general output from Visual Studio.

Ctrl + Alt + Enter

Live Web Preview

Only available with the Web Essential plugin. Launches the auto-updating Preview panel.

Testing Shortcuts

These are shortcuts that are used for running tests in the IDE. Please note, Visual Studio 2010 is all about context. If your caret is within a test method when you use one of these combinations, the combination will apply to that test. If your caret is within a test class, it will apply to that class. If the caret is outside of a test class, it will apply to all tests.

Shortcut

Action

Visual Studio 2010 Functionality

Ctrl + R T

Run Test(s)

Run all tests in the current context without a debugger attached. Breakpoints will not be stopped on.

Ctrl + RCtrl + T

Run Test(s) (Debug)

Run all tests in the current context with a debugger attached. This allows you to use breakpoints.

Substitute A for T from the preceding combos to run/debug ALL tests in the current context.

Substitute Y for T from the preceding combos to run/debug ALL impacted/covering tests for a method in the current context.

Advanced Editor Shortcuts

These are shortcuts that are used for more advanced editing in the editor window.

Shortcut

Action

Visual Studio 2010 Functionality

Shift + Alt + ↑

Shift + Alt + ↓

Multiline caret up/down

Use this combo to edit multiple lines at once. Not too many uses for it, but once in a blue moon one comes along.

Ctrl + Alt + Enter

Insert Line Above

Inserts a blank line above the line the caret is currently on. No need to be at end or start of line, so no cutting off words/code.

Ctrl + KCtrl + C

Comment Selection

Comments the current selection out of compilation.

Ctrl + KCtrl + U

Uncomment Selection

Uncomments the current selection into compilation.

Ctrl + KCtrl + D

Format Document

Automatically formats the document into a structured layout. Lines up nodes or code into columns intelligently.

Alt + ↑Alt + ↓

Code line up/down

*Use this combo to move a line of code up or down quickly. Great for small rearrangements of code.

*Requires the Productivity Power pack from Microsoft.

Conclusion

This list is by no means meant to be exhaustive, but these are the shortcuts I use regularly every hour/minute of the day. There are still 100s more in Visual Studio that you can discover through the configuration window, or by tooltips.

Something that I started doing months ago seems to have interest in my office.. In my last post, I talked about how I hated a cluttered UI. One of the ways that I aimed to resolve that was by systematically cleaning up the toolbars week by week. First day, I removed ALL icons that I already knew shortcuts to, or would never use them (Undo in a toolbar?!). Then, every week from that point on, I make it a point to remove an icon/two from the toolbar and make an effort to remember its key combination. I gain extra space in the toolbar area, AND become more productive at the same time!

I hope that you found this article interesting or at least somewhat informative.. Maybe a shortcut or two you didn't know. I know some of them seem trivial, but I often see people going to the edit menu for Copy/Paste... Thought a refresher might be helpful!