views:

2658

answers:

34

Let's show some Resharper love and learn new shortcuts while at it:

Along the lines of Joel Spolsky's "What is your single favorite keyboard shortcut in Emacs?" what is your single favorite Resharper shortcut? One shortcut per answer, please.

Would it be:

  • ctrl-N/ctrl-shift-N (open type/open file)
  • ctrl-shift-G (a friend calls this "Super Go")
  • alt-ins
  • ctrl-k-ctrl-s/ctrl-/ (comment/uncomment)
  • f2 (rename method/variable etc.)

I figure we can deal with more than one favorite by providing multiple answers - let the best ones rise to the top.

UPDATE:

I think we have to give this on to Ilya because of his work with Resharper in the first place. Thanks Ilya!

Honourable mention to bdukes for multiple entries in the format requested, the link to reference for Resharper shortcuts for those that don't know it yet, and the mention of the Scout plugin.

For the category of "a shortcut I didn't know that I'm glad to have now": although not necessarily a Resharper one, is Jivko Petiov's for remapping File.OpenContainingFolder to Alt-O

Thanks all!

A: 

CTRL+ALT+j (surround with)

Ben Hoffstein
A: 

Most of my favorite ones are custom made. But a really good one that is standard is Ctrl + Alt + Down Arrow.

That will drop down the list of open files that can be typed into for searching and switching files.

All of this totals to a nice easy keyboard way to switch between open files.

Vaccano

Vaccano
+6  A: 

Alt-enter does so many things based on your context.

More favs:

  • control + shift + r: pop up a list of refactorings available in your context
  • control + F6 (when your cursor is on a method signature): change the method signature
  • F2: the easiest one to get used to, rename (as already mentioned)
casademora
+4  A: 

F12 - Go To Definition (made even better through the Scout plugin, which'll go to .NET Source, then Reflector if it can't show you otherwise).

bdukes
Isn't that navigate to next error/warning/suggestion?
Ted
Just checked out Scout. Sweet and thanks!
Ted
A: 

Ctrl+R, O to move a method

bdukes
Or F6 (and it's got to be a static method)
Ted
+1  A: 

Ctrl+R, M to extract method

bdukes
+2  A: 

Ctrl+R, R to rename

bdukes
+2  A: 

Ctrl+E, U to surround with a live template

bdukes
+1  A: 

Shift + F12 and Alt + Shift + F12 to find usages of a member

bdukes
+2  A: 

Ctrl+Alt+V - Introduce field / variable.

axk
+4  A: 

CTRL-N - find class. Most heavily used.

ripper234
+1  A: 

Ctrl + Shift + R to refactor the current selection

bdukes
+1  A: 

Ctrl + T to go to type

bdukes
A: 

Alt + \ to go to member

bdukes
A: 

This'll be hard to actually vote on, because pretty much all of the above are huge time savers.

I'll add ctrl-shift-backspace (navigate to past edits)

Ted
+2  A: 

ctrl-shift-alt-arrow (move method up and down)

Ted
+1  A: 

CTRL-ALT-M => Extract Method, very nice for refactoring

CTRL-ALT-V => Extract Variable: i don't define variables any more, i just write a statement and extract it then :)

CTRL-ALT-J => surround with (i just love it!)

and of course: F2

MADMap
+1  A: 

For completeness and cross-referencing, IDEA/ReSharper 2.x keyboard shortcuts and Visual Studio keyboard shortcuts

bdukes
+7  A: 

Some very useful shortcuts rarely known:

Recent Files (Ctrl-,) Recent Edits (Ctrl-Shift-,) Locate in Solution Explorer (Alt-Shift-L)

PS: VS keymap

Ilya Ryzhenkov
You should add these to the keymap pdf.
Tony_Henrich
+5  A: 

It has to be Alt+Enter. I use it more than any other short-cut in any other program.

Mark
+1  A: 
  • alt + o

It's actually custom and maps to File.OpenContainingFolder.

  • ctrl + f
  • ctrl + shift + f

Global search. Invaluable when going through lots of source code.

Jivko Petiov
Love it! Wonderful! (and other superlatives in order to reach the 10 character minimum here).
Ted
+2  A: 

I'm a CTRL-ALT-F (code cleanup) junkie

Mauricio Scheffer
A: 

ALT+R, U, N - run all unit tests.

ALT+R, N, C - create a new class.

ALT+R, N, I - create a new interface.

JC
You can create new class/interface/etc by going to the solution explorer (CTRL+ALT+L) and pressing ALT+INS.
Drew Noakes
I also wish there was richer (and simpler) set of shortcut keys for running unit tests. Maybe one to re-run the last batch.
Drew Noakes
A: 

VS provides CTRL+ALT+L to show the solution explorer. However, this just focusses the panel. To move to the active document in solution explorer, use the command provided by ReSharper: ReSharper.LocateInSolutionExplorer.

You can bind commands to keystrokes via Tools > Options > Keyboard.

Personally, I bound this to CTRL+SHIFT+L and use it many times a day.

Drew Noakes
+1  A: 

In 2006 I requested a new ReSharper feature that allows moving left and right one 'hump' at a time. That is, in SomeSortOfPascal or someSortOfCamel symbol, you can move within words.

i.e. myLengthyVariableName
     ^ ^      ^       ^   ^

You can make this the default behaviour for CTRL+LeftArrow and CTRL+RightArrow (via CamelHumps in the R# options) but personally I can't do without moving left and right with great speed. So instead you can map these commands yourself to whatever keystrokes you like. Here are the ones I use:

Default set from VS:

  • CTRL + LeftArrow (move left one word)
  • CTRL + RightArrow (move left one word)

My additional mappings:

  • CTRL + > (move left one hump)
  • CTRL + < (move right one hump)
  • CTRL + SHIFT + > (extend selection left one hump)
  • CTRL + SHIFT + < (extend selection right one hump)

The commands for these can all be found by filtering the command list on the term hump. From memory they are HumpLeft, HumpRight, HumpExtendLeft, HumpExtendRight.

You can bind commands to keystrokes via Tools > Options > Keyboard.

I only wish R# supported these commands in dialogs. More often than not when renaming things I'm inserting, removing, moving or changing one of the terms within a compound word.

Drew Noakes
A: 

For my Resharper has two great features: Find type (Ctrl + T) and locate file in solution explorer (Alt-Shift-L).

I can't live without them, because usually I know what class I want to see but I don't know where in solution it is.

+1  A: 

CTRL + M, CTRL + O (Collapse To Definitions)

Josh Bush
+1  A: 

use of capital letters to navigate through intellisense suggestions

Brijesh Mishra
A: 

I think all of the find shortcuts are my favorite (Ctrl+T, Ctrl+Shift+T, etc)

I do wish that the symbol find would be confinded to the current file though.

Steven
+1  A: 

Shift+Alt+PageDown => Goes to next error in solution. Requires you have solution analysis turned on.

Nasit
+1: Thanks - I didn't know about this one.
Jim G.
A: 

As a bit of an addition to the Alt + Enter i rebind this to something else (i use Alt + #). It's in the VS options under keyboard, called "Quickfix". You can then assign this to any additional buttons on your mouse for super quick access.

Kohan
A: 

I really like ALT+Shift+F11, Highlight Usages.

Say you've got a big file open and you want to quickly see where the current word is used in the file.

If your caret is over a class name like HtmlAnchor, use this shortcut and it'll show blue highlights in the overview bar on all the places that HtmlAnchor is used.

Press Esc to remove the blue highlighting when you're done!

Russ C
A: 

use VisualAssistX then

Alt + O => open header/source
Alt + G

or create many other shortcuts for "create definition", "rename", "encapsulate field", "create comment"

ufukgun
A: 

If I'm refactoring another developer's code, Inline variable or Safe delete

CTRL+ALT+N
ALT+DELETE

If it's my code, Extract method

CTRL+ALT+M

(using ReSarper/ItelliJ Idea style shortcut bindings, not Visual Studio's, you can set this using ReSharper-> Options -> General)

Serkan