I would like to be able to run rg -Ttests instead of typing rg -g'!tests/' -g '!test/' -g'!Tests/' -g '!Test/' , is that possible?

2 Answers 2


You can't use -T (or -t) for this, since -t/-T are for file types, and file types don't actually apply to directories at all. This probably could be documented better.

The tests='...' solution from @OhMyGoodness is a pretty good one. You could also define an alias:

alias rgT="rg -g '!tests/' -g '!test/' -g '!Tests/' -g '!Test/'"

How about an environment variable?

 tests='-g!tests/ -g!test/ -g!Tests/ -g!Test/'
 rg $tests foo

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .