3

I want to exlude certain files such as .gitignore in consult-git-grep search.

  • consult-git-grep works find with following defualt setup:

(setq consult-git-grep-args "git --no-pager grep -F -n --no-color -I -e '%s')

I have updated consult-git-grep-args definition where -- '(exclude).gitignore' is added at the end, but it crashes. How could I make it work?

init.el

(require 'consult)

Followed by:

(setq consult-git-grep-args "git --no-pager grep -F -n --no-color -I -e '%s' -- '(exclude).gitignore'")


Related: How to exclude certain directories/files from counsel-git-grep search?

consult-git-grep already ignores files you put in .gitignore. In order to exclude additional files you can write on the consult-git-grep prompt:

#foo -- :!*.org #foo -- :!.gitignore This will search for foo and ignore *.org files or the file .gitignore. If you want to hard code these settings adjust the variable consult-git-grep-args, which is similar to counsel-git-grep-cmd-default.

alper
  • 1,238
  • 11
  • 30

0 Answers0