Search code examples
webstormjetbrains-idehotkeys

Is it possible to switch between the list of results in 'Find in Files' and the usage preview in the file?


Often times I'm doing a search on some sort of property and I want to make changes to what I'm searching in many files.

Doing a Find and Replace is one option, but sometimes the changes are too nuanced to do so.

Ideally, there would be a set of hotkeys that allow me to toggle from the list of results to the file preview below it, and back.

Are there such hotkeys? I couldn't find any when looking through the IDE, but the name may be a bit cryptic if it does exist.

That, or is there a flow similar to this that would work well, plus have hotkeys to support it?

Find in files


Solution

  • Ideally, there would be a set of hotkeys that allow me to toggle from the list of results to the file preview below it, and back.

    Sadly, there are no such hotkeys. Simply because there are no such actions available. A few useful tickets to watcher after (star/vote/comment) to get notified with any progress:

    • IDEA-230848 -- Add a shortcut to switch between the search box and preview editor in 'Find in Files'
    • IDEA-242962 (and linked tickets) -- Allow keyboard navigation in the Find in Files dialog

    What you can do is:

    1. When you are using Find in Files or Find and Replace in Files (the popup that you have on your screenshot). Instead of using it (which is very advanced but still only a preview of a full search: as it can show TOP 100 results only -- keep that in mind), use "Open in Find Window" button at the bottom to open ALL results in a dedicated Search Results toolwindow.

      enter image description here

    2. That toolwindow also has the preview area (may needs to be enabled first) as well as the ability to group files by folders / A-Z order etc. (that Find in Files popup cannot do).

    3. I do not see an action / shortcut to jump between the list of results and the preview area either here... but the Jump to Source action (F4 here on Windows keymap) will open the actual file in the right place.

      enter image description here

    4. Once you finish editing that fragment, you can press F12 (here on Windows; or whatever shortcut you may have there for Menu | Window | Active Tool Window | Jump to Last Tool Window) to go back to the search results list.

      enter image description here

      Obviously, if you invoke another toolwindow during that time, it may not go back to the Search Results one. In this case, you will have to use your mouse or some another way of keyboard navigation (e.g. assign custom shortcut just for that toolwindow, or by using Switcher (Ctrl + Tab) etc.)

      P.S. "Search Results" (also known as "Find" in the toolwindows list) has Alt + 3 shortcut buy default.

      enter image description here