ripgrep
2
总安装量
2
周安装量
#66624
全站排名
安装命令
npx skills add https://github.com/millionthodin16/clawd-explorations --skill ripgrep
Agent 安装分布
codex
2
claude-code
2
antigravity
2
windsurf
1
opencode
1
Skill 文档
ripgrep (rg) – Fast Search Tool
Fast line-oriented search tool that recursively searches the current directory for a regex pattern.
Quick Start
rg "pattern" # Search for pattern
rg -l "pattern" # List files only
rg -t py "pattern" # Search Python files only
rg -A 3 "pattern" # Show 3 lines after match
rg -B 2 "pattern" # Show 2 lines before match
rg --vimgrep "pattern" # Output for editors
rg "pattern" /path/to/search # Search specific path
Commands
Search Files
uv run {baseDir}/scripts/rg.py search "TODO" # Find TODO comments
uv run {baseDir}/scripts/rg.py search "def main" --type py # Find functions in Python
uv run {baseDir}/scripts/rg.py files "class.*Agent" # Find classes
Find Files by Pattern
uv run {baseDir}/scripts/rg.py find "import" --type py # Files with imports
uv run {baseDir}/scripts/rg.py count "error" # Count occurrences
uv run {baseDir}/scripts/rg.py hidden "secret" # Search hidden files
Git-Specific
uv run {baseDir}/scripts/rg.py staged "FIXME" # Search staged changes
uv run {baseDir}/scripts/rg.py commits "feat:" # Search commit messages
Examples
Find All TODO Comments
rg "TODO" -n --type md
Find Function Definitions
rg "^def " --type py -n
Find All Imports
rg "^import|^from" --type py -n
Count Lines of Code by Language
rg -l --type py | wc -l
Why ripgrep Over grep?
| Feature | grep | ripgrep |
|---|---|---|
| Speed | Baseline | 10x faster |
| Recursive | Need -r | Default |
| Color | Need –color | Default |
| Smart case | No | Yes |
| Filename only | -l | -l |
| File types | –include | -t |
Installation
brew install ripgrep # macOS
cargo install ripgrep # Linux/ARM64
See Also
- Full workflow guide:
memory/WORKFLOW.md– Decision tree for when to use ripgrep vs other tools - Tool comparison:
memory/HIGH-IMPACT-TOOLS.md– Why ripgrep over grep
Files
scripts/rg.py– CLI wrapper