projectile-greps are probably the commands that I use the most. However, with some very large projects I am frequently interested in grepping only one subdirectory of the project. For my greps I usually use helm-projectile-agbut it recursively greps in project's root.

The closest think that I have found is helm-do-grep-ag but it works on default-directory. To achieve the effect on grepping specific directory I first have to set that directory as default-directory.

How do you achieve grepping in project's subdirectory? Is there some parameter that I am terribly missing somewhere?

  • At minimum, M-x rgrep will let you do this. (or M-x lgrep if you don't want recursive searching). I'd be surprised if other facilities don't have that as an option, though. Have you tried using a prefix argument? – phils May 2 '19 at 0:01

For grep itself, M-x rgrep (recursive from specified directory), and M-x lgrep (specified directory only) let you do this.

| improve this answer | |

To achieve what you described I use: helm-ag package. helm-do-ag interactive function will prompt you for the directory where to search. Just bind it to your preferred key shortcut.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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