Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you deselect the text in a rename dialog without moving the cursor, with the keyboard, in IntelliJ IDEA

I'm using IntelliJ IDEA 10.5.2

Example:

code

Say I want to rename this class to SomeAwesomeClass. If we do the Rename refactoring we get a dialog like this:

rename dialog

It has the cursor in the right place however the text is selected. So if we started writing "Awesome" the original name would disappear. So what I want to do is keep the cursor position but deselect the text.

I have not been able to find any way to do this. All things I've tried ether moves the cursor or removes the text or does nothing.

  • Left or Right keys goes to the left or right.
  • Up or down does nothing.
  • Esc closes the dialog.
  • PageUp or PageDown does nothing.
  • Home or End goes to left or right.

The fact that the cursor is in the right place to start with makes me believe this is a existing feature...

like image 570
Andreas Avatar asked Oct 31 '11 15:10

Andreas


People also ask

What is Ctrl Alt L in IntelliJ?

Sometimes code formatting can get out of sync, but there's an easy fix in IntelliJ IDEA. You can use ⌘⌥L (macOS), or Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings.

What does Ctrl d do in IntelliJ?

I use Ctrl+D to add to selection (discrete multiple select) the next occurrence of the string (or substring) highlighted. And to skip adding next immediate selection to selection but the one after it, I use Ctrl+K, Ctrl+D.

Can you use IntelliJ without mouse?

After you are done working with a tool window like the Project tool window, Debug window, Maven, or others, use Esc to return to the editor (instead of using the mouse to click in the editor window).

How do I select the same text in IntelliJ?

Press Ctrl+Alt+Shift+J to select all case-sensitively matching words or text ranges in the document.


1 Answers

In 11-eap (110.365) when you rename a class (Shift+F6):

  1. at first full class name is selected and you have a dropdown with suggested names, press Esc
  2. full class name is still selected (dropdown gone), press Esc again
  3. you have class name unselected, and can write at cursor

Note a third Esc will exit rename.

In earlier versions (10.5.2) you can do a trick:

Before rename select one character (shift+arrow forward) where you want to end up (in SomeClass select C) then Shift+F6 and arrow back. I know it is a lot of keys to presses but in a long class name this helps.

like image 194
osundblad Avatar answered Oct 15 '22 11:10

osundblad