Visual Studio Tip, Your Own Keyboard Shortcuts
August 2, 2009

Among the best productivity tips we developers should follow first is this one: let’s get our hands off that bloody mouse (we should make it a song and sing it along everyday but we would look silly at best).
Of course, by default Visual Studio is full of keyboard shortcuts but adding your owns can be a huge benefit. Here’s a few examples.

Get Rid of Those Tabs

How often do you find your favorite IDE cluttered with numerous tabs?
Simply map a keyboard shortcut to the command File.CloseAllButThis.

I mapped it to something I could easily remember: Ctrl+B, Ctrl+B as in “Bye Bye” tabs.
It’s a simple tip but it can save you a lot of time.

Closeallbutthis
Of course you might still need to go back to the last two or three last opened tabs. To do this, I always have the Undo Close window at hand. Better yet, use bookmarks on your current investigations.

Quickly Duplicate a Line

Another shortcut you can often find in other IDEs but that is missing in VS is a combo for Duplicate Line.

However since this command is not builtin, you have to add it as a macro (this is exactly what Christophe Herreman suggests in a blog post) or use it from the additonal commands provided by ReSharper:

Duplicateline
Disclaimer: this one is to be used at your own risks as copy/paste is dangerous for code reuse.

Notes

Once you have set your shortcuts to your taste do not forget to export your settings.

To have a quick grasp of the VS builtin shortcuts, lots of people have compiled cheat sheets such as NerdFortress’s.

CodeProject