7

I usually find myself when using helm-projectile-grep to narrow my search down to a specific file type.

For example: I do a search for "container" but only want to show the results in the .style files. I haven't been able to find if you can do this with helm-projectile-grep but it does seem like it should be possible.

2 Answers 2

2

It is possible with the helm-ag package, which passes every "--" prefixed field to ag as CLI arguments.

To filter by file type use its extension as an argument. So calling helm-projectil-ag with:

--style container

will do the trick.

Additional examples:

--hidden search-pattern

Will include hidden files during search for search-pattern

--ignore=*.html container

Will ignore all html files. Note that --ignore accepts glob pattern instead of regexp.

Requirement

To use helm-ag you should install ag, which is multi-platform, uses perl-like regexp by default and is way faster than grep.

2
  • this doesnt work with helm-projectile-ag
    – RichieHH
    Aug 23, 2020 at 19:57
  • @RichieHH yes, and I have never stated that.
    – atevm
    Aug 26, 2020 at 12:05
0

Unlike RichieHH stated in a comment under atevm's answer in 2020, it now do work with helm-projectile-ag too 🎉

For example, I managed to search for a string in all php files with :

stringIsearchFor -G=*.php

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.