1

I am running the command helm-do-grep and I notice that the search is not recursive, i.e. it searches only in the directory I specify and not in subdirectories. How do I direct helm-grep to automatically search recursively?

1 Answer 1

1

helm does offer a non-recursive and a recursive command, by default it's using the non-recursive one when invoking M-x helm-do-grep unless it has been called with a prefix argument. The values for the non-recursive and recursive command are stored in the helm-grep-default-command and helm-grep-default-recurse-command variables.

The easiest way of achieving recursion by default would be setting the former variable to the value of the latter.

(eval-after-load 'helm-grep
  '(setq helm-grep-default-command helm-grep-default-recurse-command))

Caution: The solution above might have unintended consequences, such as using grep on the buffers list to recurse on every listed file.

8
  • What's helm's recursive command? (I see helm-do-zgrep...) Would calling helm's recursive command be a safer way to invoke grep recursively than the above? Commented Jan 19, 2015 at 3:35
  • You can inspect it with F1 v helm-grep-default-recurse-command.
    – wasamasa
    Commented Jan 19, 2015 at 8:42
  • I get grep -a -d recurse %e -n%cH -e %p %f. What's the correct string for recursive searching? Commented Jan 19, 2015 at 21:10
  • Well, you set helm-grep-default-command to this value by (setq helm-grep-default-command "grep -a -d recurse %e -n%cH -e %p %f").
    – wasamasa
    Commented Jan 19, 2015 at 23:06
  • But what's the new value for recursive search? Commented Jan 20, 2015 at 7:17

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.