0

I am using counsel-git-grep to grep for a string in the current Git repository.

Lets assume I am searching string " [ok] ". In order to obtain correct results I have to provide input as " \[ok\] " ; where \ should be added before some characters like [, ], ", etc.

Is there any way achieve the grep results without using \?

1

I think in theory this should be possible by adding -F to the grep flags in the counsel-git-grep-cmd-default variable by evaluating

(setq counsel-git-grep-cmd-default "git --no-pager grep -F -n --no-color -I -e \"%s\"")

(of course you could add this to your init.el file)

However, I am not sure if it works in practice (because of some weird behaviors I am not able to test it here quickly).

2
  • This ignores the white spaces tho like hello world couldn't be search. For a single space, I had to do double space -- is this behavior normal? – alper Nov 18 '20 at 17:21
  • According to this section of the Ivy manual, this is indeed normal behavior – dalanicolai Nov 19 '20 at 22:37

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.