IDEA 11 - Search and replace-values "lost" between invocations
In IDEA 11.0 on Mac OS X, I am doing a search and replace by pressing cmd-r and putting in xXx in the search box and yYy in the replace box, and selecting "preserve case". The next time I want to search and replace, I want to search for xXx1 and replace it with yYy1 (also with preserve case), but when I press cmd-r the boxes are empty so I have to enter the values again (I can select from the drop-down list for both cases, but for the replace values I have to use the mouse). I also have to select "preserve case" again.
In IDEA 7.0.3 on Windows XP, all the values were preserved between invocations, so all I had to do was to press ctrl-r, and tab between the search field and replace fields and edit them slightly. Also, there "preserve case" (which is what I use in 90% of the cases) is shown as a check-box, I didn't have to go into a menu to see how it was set.
Is there a way to get back this functionality in IDEA 11? It may seem like a small thing, but when doing a lot of related search- and replace-operations it makes a difference.
I am using IDEA 11.0 build #IC-111.69 on Mac OS X 10.7.2
Please sign in to leave a comment.
Hi!
Now you can just hit Enter in the search box right after Replace invocation. It will restore everything from your previous replace.
Hi Andrey,
Thanks for your answer! Yes, I get the old values back when hitting Enter - great!
After I have restored the search and replace values, I'd like to continue to search and replace using the restored values. Is there a way to do this using only the keyboard, or do I have to use the mosue and click the Replace button?
Hi again Andrey,
I've run into a problem with restoring the replace values. If the last operation I did was a find (cmd-f), and I then hit cmd-r to do a replace, then hitting enter restores the last find operation (and switches to a find) - but what I want to happen is to restore the last replace values.
It seems like find and replace use the same common restore function, but I think it would be much better if they had individual restore functions. As it is now, if I have used find in-between the last replace, I can not restore the replace values – I get the last find values.
It's not so simple. Actually Find operation is a part of Replace. When you do Replace you perform Find too. I don't see any reasons to split this two functions. It can be confused because you can do some Find and switch to Replace and then back to Find. I think it's quite common case. To restore something more distant you still have history for both find and replace fields separately. Use down arrow or Strl-H to activate it.
Use mnemonic Alt-P shortcut to perform replace from keyboard.
Thanks, just what I was looking for!
Is Alt-P documented anywhere? I searched for a keyboard short-cut like it, but didn't find anything.
Hi Henrik,
Whenever you see control with text where particular letter is underlined, you can press Alt+<underlined-letter> to activate the control:
Denis
Well, in IDEA 7 it worked like I described.
In IDEA 7, suppose I first did a replace from xXx to yYy, and then did a find for aaa. Now, if I do cmd-r for a replace, I get the back the xXx and yYy. However, in IDEA 11, at the second replace, I get empty lines for the find and replace values. Normally, hitting enter here restores the last used values (as I learnt at the beginning of this thread). But now, since I had done find for aaa since the last replace, when I hit enter the replace operation changes to a find operation, and aaa is entered in the search box. This I find odd. It means that I can restore the previously used values for a replace, except for if I did a find in-between.
My experience with find and replace is that I use find a lot more often then replace, and for different strings. When using find and replace in that way, I think it makes sense to have find and replace behave independently of one another in terms of restoring past values.
Hi Denis,
Thanks, but I am using IDEA on a Mac, and there I don't see any underlined letters (but it would have been good!). Is there any other place where I can find this out?
Got you. I think you are right. Please follow http://youtrack.jetbrains.net/issue/IDEA-79447
Thank you.
They are expected to be displayed when Alt is pressed (Mac specifics, they are shown all the time for Windows, Linux).
Denis
Yep, they are displayed when I press Alt. Excellent!