I'm using counsel-git-grep to search inside a project for a specific string, which works great. However, I would like to additionally specify a filetype pattern to reduce the result set. I tried queries like string -- '*.filetype' but none of them worked. I know I can customize the counsel-git-grep-cmd-default but this seems to be a very static approach.

So the question is, is there a way to define a filetype pattern inside a query string of counsel-git-grep?

  • FWIW, a slightly less static alternative to customising counsel-git-grep is invoking M-x counsel-git-grep-switch-cmd RET to do it for you (with history). – Basil Dec 2 '17 at 14:19
  • You can also modify the command for each invocation of counsel-git-grep by calling it with a prefix argument, i.e. C-u M-x counsel-git-grep RET. – Basil Dec 2 '17 at 14:30

Your Answer

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

Browse other questions tagged or ask your own question.