Where are find next selected and find previous selected?

I've looked throughout the IDE for find next and previous selected and can't find them. I want to search up and down the document for the current selection, as I can in other IDEs.

7 comments

Hi Darien,

1.a) Make a selection & Press "Ctrl+F" to invoke "Quick Find" (in current document only) -- all occurrences will be highlighted so you can easily spot them
1.b) or .. just use Ctrl+F3 (Search | Find Word at Caret) for single word search
2) Now you can use F3 & Shift+F3 to navigate between Next and Previous occurrences

If that is not what you need, then you can also check File | Settings | Keymap and see all available actions (you can filter them, for example, by word "Next") -- maybe you will find more convenient way.

0

Hi, that is helpful, but not exactly what I am looking for.

I usually bind Ctrl+Shift+Up Arrow and Ctrl+Shift+Down Arrow to find previous/next selected in editors. This gives me a one-step method to go through a document to find my way around between related areas of code. Pressing Ctrl+F and using F3 and Shift+F3 works similarly, but I am looking for a one-step solution. Is there a way to code this into the IDE using macros?

0

Hi Darien,

Macros are available and you can record such actions, I just do not know how convenient it will be (I'm only using 2 simple macros and they do the job for me). Once recorded you can assign custom shortcuts to macros in File | Settings | Keymap.

Alternatively, you still can use Ctrl+F route and just re-assign different shortcuts instead of F3 and Shift+F3 (yeah -- it's still one extra key combination to press).

0

I tried setting up a macro for this and it did not work. Looking at the macro editor for "Find Next Selected", it recorded 2 actions:
Find
FindNext

However, when using the key assigned to the macro, the editor only performed "Find".

When trying to record "Find Previous Selected", I could not get the macro recorder to recognize "FindPrevious" as an action at all.

Is there a deeper, more API-level interface I can use to write this feature?

0

Hi Darien,

I tried setting up a macro for this and it did not work. Looking at the macro editor for "Find Next Selected", it recorded 2 actions:
Find
FindNext

However, when using the key assigned to the macro, the editor only performed "Find".

I have exactly the same results.

When trying to record "Find Previous Selected", I could not get the macro recorder to recognize "FindPrevious" as an action at all.

Worked ok for me (I mean -- I have managed to record such macro and it worked) until shortcut key was assigned to it.

Basically, when recording these macros, my algorithm was:
* make a selection ( for example, in some class where you have quite a few matches)
* start recording macros
* press Ctrl+F
* click on "Find Next" or use F3 shortcut (or "Find Previous" if searching backward)
* press ESC key to close Quick find window/toolbar
* press F3 (or Shift+F3) and repeat it again (yeah -- 2 times)
* stop recording macro
* make a selection and playback macros. If it jumps to far -- the edit macros and remove one of the "Find Next/Prev" actions. Test again.

It has to be some breaking changes, some regression in latest build(s). Because right now (EAP build PS-98.271) once PhpStorm got restarted all macros are gone (as they have never existed) -- and macros.xml file (which suppose to be used to save macros) is left untouched (the timestamp is current, but content is the same before and after session.

Is there a deeper, more API-level interface I can use to write this feature?

As far as I'm aware -- no. PhpStorm has very weak macros support I have to say (my personal opinion) -- that's why I'm not using it.

0

Thanks Andriy,

I'll try your technique for the macro. I was just pressing Ctrl+F, Shift+F3, then stop recording.

In any event it would be good if they added "Find next/previous selected" as built-in commands. It really speeds up development.

Do you know if IntelliJ IDEA has any better macro editing capabilities?

0

Hi Darien,

You are welcome to submit new feature request here: http://youtrack.jetbrains.net/issues/WI#newissue=yes.

Based on my observations/experience I do not expect this to be implemented any time soon. The reason behind (at least what I think it may be) -- it requires only one extra key combination (the initial Ctrl+F) and it even nicely displays all matches as markers on vertical scroller. But if you can provide enough good arguments (like, for example, such feature is implemented in such products (that are in some way competitors to PhpStorm) ; or if you can describe really good advantages compared to the current way of doing it; etc.) then it may indeed be implemented much sooner.

As for IntellliJ IDEA -- I have never used it and therefore I do not know how good it is with macros support.

0

Please sign in to leave a comment.