BAERUS
BAERUS

Reputation: 4319

Intellij IDEA: Make refactor > Rename not select the whole word

When I press my shortcut to rename a variable (precisely it's the "Main menu" > "Refactor" > "Rename..." shortcut), the entire word is selected.

Is it possible to change the behavior so that simply the refactoring is activated and the cursor stays in position (it already does, this is fine) and that I can directly add or remove a character?

Right now, if I have a variable "myVarible" and I put my cursor between "i" and "b" to add the "a", press the shortcut, and type an "a", my entire variable becomes an "a", as the entire word was selected by the shortcut.

In Eclipse this seems to be the default behavior already, and I liked it much better. How can I change this in Intellij?

Upvotes: 28

Views: 1986

Answers (4)

Ruik
Ruik

Reputation: 1361

Origin answer

Aaaand it moved again!

It's probably the best to just search for Refactorings or Preselect old name, as it might move again in the future.

In my version 2020.1.2 it is under

Settings -> Editor -> Code Editing -> Refactoring

enter image description here

Update Version 2023(.1)

JetBrain can't decide where to put and how to name this feature.

Since my origin answer it was renamed to "Preselect current symbol name for Rename Refactoring" and it moved to:

Settings -> Editor -> Code Editing

Upvotes: 4

jebeaudet
jebeaudet

Reputation: 1603

It has changed name since the other answers, in 2021.2.3, It's still under Settings -> Editor -> Code Editing -> Refactorings however it's now named Preselect current symbol name for Rename refactoring.

Upvotes: 1

davidxxx
davidxxx

Reputation: 131476

From IntelliJ 2018.2.6, the checkbox to disable is still "Preselect old name".
That is located in :

"Settings" menu
-> "Editor" section
   -> "General" subsection 
   -> "Refactorings" part

You can also just enter "refactorings" in the search box to find it.

disable preselect old name

Upvotes: 6

Priyank Jain
Priyank Jain

Reputation: 787

You can do this by going to Settings -> General -> Refactoring and just deselect "Preselect old name" or just type Refactor in search box in settings so it will automatically go on above menu.

Upvotes: 38

Related Questions