Question

In Visual Studio (using IDEA key mapping), Ctrl + Shift + R brings up the 'Refactor' menu.

How do I do the same in IntelliJ?

On Windows.

Was it helpful?

Solution

ctrl + alt + shift + t = refactor this

in intelliJ IDEA version 11.0.2

OTHER TIPS

If you press on CTRL + Shift + A and type in the action you want to perform, it also shows the shortcuts keys. This way you can learn shortcuts much easier.

enter image description here

The range of refactoring options in IntelliJ is fantastic, right click in your editor and hit R to see the entire menu. You'll soon want to just use the keyboard shortcuts though; some of my favourites are:

  • Shift + F6 : refactor a method or variable name
  • Ctrl + Shift + F6 : refactor a variable / field type
  • Ctrl + Alt + M : extract a method
  • Ctrl + Alt + V : introduce a variable

You'll find the main refactoring actions are bound to keys, rather than the entire menu being associated with a keyboard shortcut. The cheatsheet shipped with IntelliJ (Help > Default Keymap Reference) was invaluable when I was trying to get my head around everything that was possible. (Available online too!).

I think you can probably get the refactoring menu in Windows by hitting the Context key (next to the Right Ctrl) and then R whilst your cursor is in the editor window. Not sure if a dedicated binding exists - I'm pretty sure you can't set one.

Alt + R will pull down the menu. For instance, Alt + R, L will allow you to pull up a method.

Hm, just press ctrl+r - it does refractor pretty much anything? I switched keyboard shortcuts layout to Netbeans and tweaked it a little bit but I don't think it changed anything. True challange is "How to press DO REFRACTOR button in the usages window when you want to refractor some method used on several places WITHOUT using mouse".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top