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.

Tephra
  • 821
  • 5
  • 14

2 Answers2

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.

Andrew Swann
  • 3,436
  • 2
  • 15
  • 43
atevm
  • 928
  • 7
  • 16
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
learner
  • 121
  • 5