1

By default, when i do M-x helm-do-grep, helm prompts to search from the current buffer's folder location. I would prefer it to list the git repository's base folder (where .git folder is located) as the default string in minibuffer and search recursively down all sub folders.

How to configure helm to automatically identify folder with .git contents as base folder and use it for all search activities?

  • I wouldn't recommend doing that because you will end up at some point having multiple projects, some of which are not version-ed by git. So this kind of change won't be beneficial. Instead you should press C-. until you hit the root of the project. – caisah Jun 5 '15 at 11:05
  • i realised that sometime later... and yes, your solution fixes that..... – Madhavan Jun 5 '15 at 14:09
2

Probably not the direct nor best solution to your problem, but it does the trick:

(defun my-grep-repo ()
  (interactive)
  (helm-do-grep-1 '("/path/to/root/project")
                  '(4)
                  nil
                  '("*.py" "*.py")))

You can also replace the '(path/to/root/project) by the returned value of vc-root-dir or magit-get-top-dir

0

helm-grep-do-git-grep

if your are in hybrid mode, you need in 'insert mode', because when you are in 'emacs mode', you can use C-u to add an Prefix and then use helm-grep-do-git-grep

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.