I want to exlude certain files such as .gitignore in consult-git-grep search.
consult-git-grepworks 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 alreadyignores files you put in.gitignore. In order to exclude additional files you can write on theconsult-git-grep prompt:
#foo -- :!*.org#foo -- :!.gitignoreThis will search for foo and ignore*.orgfiles or the file .gitignore. If you want to hard code these settings adjust the variableconsult-git-grep-args, which is similar tocounsel-git-grep-cmd-default.