4

I recently found Projectile and I am loving it. I really like the ivy/counsel integration as well. One thing is missing though:

I am working on a huge project of hundreds of files. This is stored in one big massive Git repository which projectile recognizes as the root of the project. I'd like to keep it recognizing this as the root, as there are some dependencies across the various folders.

How can I run projectile search (e.g. C-c p s r for using ripgrep) and limit results to a specific sub-directory in that project?

Update 2020-06-17

I just found the --iglob option for ripgrep. I'll keep looking for a way to use this along with counsel-projectile-rg, but if anyone knows I'd love to hear an answer!

5
  • hundreds == "Huge" ;-) I just counted the number of files in our project: 68921.
    – Tobias
    Commented Feb 27, 2020 at 18:20
  • @Tobias Oh gosh. That is huge. … I just checked and this project too has a few thousand files. A lot of those are build artifacts; narrowing the scope of the search yields about 1300 files. Whatever it is, +100 is a lot of search results to come through. :) Commented Feb 27, 2020 at 18:24
  • Maybe, elgrep can help you. You can give regexp for the directories and files you want to search. Furthermore, you have multiple search criteria for each file. You can even split each file into search records. That should allow you to narrow the hits.
    – Tobias
    Commented Feb 27, 2020 at 18:33
  • 1
    For your case I do use rg.el which ask about where to search and and some other options. Also use counsel and a few others tool wrappers as convenience.
    – Muihlinn
    Commented Jun 17, 2020 at 23:03
  • Note that helm-do-ag as mentioned in this answer seems to work: stackoverflow.com/questions/39982412/…
    – xji
    Commented Apr 9, 2023 at 15:23

1 Answer 1

2

You can also try C-u M-x project-find-regexp.

It's a part of the project package, built-in in the latest versions of Emacs but also distributed through GNU ELPA.

Be warned though: this calling convention doesn't honor the .gitignore entries (only ignores standard "junk" files and utility directories). So if you have a lot of files in the subdirectory as well, it could take a while.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.