name: ripgrep description: Search code and text files via ripgrep (rg) in Bash. Prefer rg over the Grep tool: rg gives full unredacted output, supports pipe composition, and exposes flags Grep does not (-F, -w, -L, -v).
ripgrep
Default invocation:
rg -n -C 2 -t TYPE -e 'pattern'
-nline numbers-C 2two lines of context before/after-t TYPEfile-type filter (-t js,-t py,-t go, ...;rg --type-listfor the full set)-e 'pattern'single-quoted to keep the shell out
Tool selection
Default to Bash(rg) for code/text search. Grep is the Claude Code built-in (also rg under the hood) but truncates output, cannot pipe, and exposes only a subset of rg flags. Use Grep only when the search is trivial and structured output is desired.
Glob handles filename-only matching.
Non-default flags worth knowing
-Fliteral pattern, no regex -- use when the pattern contains.(*etc.; avoids escape hell-wwhole-word match ---w -e 'test'won't hittestingorlatest-l/-Llist files containing / not containing the pattern-g 'glob'glob filter when-tdoesn't fit (-g '*.test.js',-g '!vendor/**')-e 'a' -e 'b'multiple patterns, OR semantics