IntelliJ IDEA global search

2019-01-23 22:30发布

问题:

I would like to search across projects for variable usages, or at least for strings. I've got IndexYourFiles which works well for text searches, but I have to re-index every now and then and would like an integrated solution.

Is there any way that I can search across projects in IntelliJ IDEA? So far I have only been able to search within the currently-open project. I'm guessing IntelliJ can't do this natively; are there any plug-ins out there to support this?

Thanks.

回答1:

IntelliJ is project based so you can only search within the open project using Ctrl + Shift + F(Windows) or Cmd + Shift + F(Mac).

When I need to search across a set of projects I use Agent Ransack



回答2:

IntelliJ 13 (at least) has "Edit/Find/Find in Path...".
It has the Scope option which can be set to a directory, so if all projects are in the same directory (e.g. IdeaProjects) then it will search all projects.



回答3:

Use grep.

In the terminal, go to the root directory of your project, and type grep -r my_string_here ..

You can add color to your search with --color (just add alias grep='grep --color' to your.bash_profile, and add-i` to make your search case-insensitive.



回答4:

My workplace eventually set up Atlassian Fisheye which allows us to search for code or specific files across all of our projects, and it's working well.



回答5:

In the IntelliJ now it is very easy to find the anything through just two clicks and search on the bar.

Double click on shift and enter the keyword in the search bar.
I'm using ubuntu which I found the shortcut.