Is there a keyboard shortcut for the "Do Refactor" (Refactor preview panel) in IntelliJ IDE?

How to press the "Do refractor" button when you try to refract a method in (PHP, Java ..) code.

Steps:

  • Press ctrl + r to rename
  • Change the name, then press enter
  • Then another panel shows using the โ€œDo Refactorโ€ button using this method.

Is there a way to click "Do Refactor" without using a mouse?

+8
intellij-idea intellij-14
source share
2 answers

IntelliJ tries to solve as many problems as possible using only your keyboard.

In your case, a panel showing a refactoring preview is really useful. You can use the arrow keys to navigate this panel and exclude unwanted refactoring by pressing Del . To confirm refactoring, just press Alt + D. The Do Refactor button has an underscore on D , so you donโ€™t even need to remember this.

Regarding your second question (switching to a camel case): you need to check the following settings:

Settings > Editor > General > Smart Keys > Use "CamelHumps" words

Now you can move inside the lines with Ctrl + R / LArrow .

Btw: you can return to your editor at any time by pressing Esc .

And finally, you can execute almost any command by pressing Ctrl + Shift + A. Just enter the name of your command (e.g. Rename ) to execute it. Therefore, even without a shortcut, you do not need to use a mouse.

+14
source share

Each button has an underlined letter, if you press alt and this letter, then it will perform this action.

You can also move focus (by default on the main button) using the tab and shift + tab, and use the input to confirm your choice.

+3
source share

All Articles