Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com

My Favorite Keyboard Shortcuts

I'm such a wannabe ReSharper padawan. My motivation is good though: I want to be more productive. On a recent project, I was writing some code in front of a client employee, a novice developer himself, and he exclaimed "The code is just writing itself."

I learned a long time ago that I could impress my clients by navigating without the mouse, more recently I learned that I could get more work done without it.

Enough talk, here is my current set of favorite keyboard shortcuts. Some are ReSharper (R#) and some are Visual Studio (VS).

VS

Ctrl+K,C

Comment out a block of code

VS

Ctrl+K,U

Uncomment a block

VS

Ctrl+K,D

Format your code, I prefer R#'s version but this is handy for XML.

R#

Ctrl+Shift+R

Presents a context-sensitive menu for refactoring. This is a must for newbie ReSharper padawans.

The 3rd padawan must; this helps you insert "missing" code and is essential for TDD.

R#

Ctrl+Alt+Shft+F

It's a handful, but it reformats your code. This can sometimes be a bit much, and can cause some unnecessary churn in source code repository. (I do it without thinking.)

VS/R#

Ctr+Space

Did you know that R# will even suggest variables names? Isn't that totally sweet? Yes. Yes it is.

R#

F6

Moves a class, either to a new namespace or (my favorite) to a new file.

R#

Alt+F7

Find usages.

R#

Ctrl+Left Click

I was giddy when I discovered this. This is equivalent to Go To Definition.

VS

Ctrl+-

That's the minus key. It's like the back button in your browser, it takes you back to the last file you were editing. This is incredibly useful when you are writing a test, you insert a member into the class under test, and you want to jump back to the test. w00t!