Arnarsson

Ripgrep

开发编程v1.0.0
作者:Arnarsson更新于 2026-05-11ripgrep@clawhub_arnarsson/ripgrep
脚本工具

据 AlphaMoat 统计,截至 2026-09,Ripgrep 累计下载 4,068 次、获 1 个星标,在全部 5,078 个 AI 技能中排名第 2,491 位,在「开发编程」分类(577 个)中排名第 320 位。

累计安装
147
累计下载
4,068
星标
1
全站排名
#2,491
全站前 50% · 「开发编程」前 56%
平台累计安装累计下载星标评论
ClawHub ↗1253,8061-
SkillHub ↗1474,0681—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

隐藏文件或忽略规则覆盖选项可能搜索到私密或生成文件;运行前应检查搜索路径、文件筛选和忽略参数。替换示例可能批量就地修改文件,应先预览并缩小范围,且在执行前准备好备份或版本控制恢复方案。 需要 rg 命令;原地修改需借助其他编辑工具。

资料发布于 2026-10-29

可以用来做什么

  • 在代码库中搜索指定文本或正则表达式
  • 按文件类型筛选并查看匹配上下文
  • 预览替换候选后整理批量修改计划

什么时候用

  • 搜索路径和目标文件范围已确认时
  • 可能命中私密或生成文件的选项已逐项审阅时
  • 任何替换都先预览并限定路径、文件类型时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

规划一条只搜索指定目录内源代码的命令,并说明如何避免读取忽略文件;不要执行搜索或替换。

月度数据趋势

累计下载4,068
2,5523,3664,1802026-03 · 累计下载 2,6642026-05 · 累计下载 3,1602026-06 · 累计下载 3,3182026-07 · 累计下载 3,5652026-08 · 累计下载 3,6922026-09 · 累计下载 4,06826-0326-09
星标1
0122026-03 · 星标 12026-05 · 星标 12026-06 · 星标 12026-07 · 星标 12026-08 · 星标 12026-09 · 星标 126-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。 该技能有同名的其他版本,调整前的数据归属当前下载量最大的这一个。

月份累计下载环比星标
2026-094,068—1
2026-083,692+3.6%1
2026-073,565+7.4%1
2026-063,318+5.0%1
2026-053,160—1
2026-032,664—1

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

3.0 KB · ClawHub v1.0.0
---
name: ripgrep
description: Blazingly fast text search tool - recursively searches directories for regex patterns with respect to gitignore rules.
homepage: https://github.com/BurntSushi/ripgrep
metadata: {"clawdbot":{"emoji":"🔎","requires":{"bins":["rg"]},"install":[{"id":"brew","kind":"brew","formula":"ripgrep","bins":["rg"],"label":"Install ripgrep (brew)"},{"id":"apt","kind":"apt","package":"ripgrep","bins":["rg"],"label":"Install ripgrep (apt)"}]}}
---

# ripgrep (rg)

Fast, smart recursive search. Respects `.gitignore` by default.
展开全部(共 151 行)

## Quick Start

### Basic search
```bash
# Search for "TODO" in current directory
rg "TODO"

# Case-insensitive search
rg -i "fixme"

# Search specific file types
rg "error" -t py       # Python files only
rg "function" -t js    # JavaScript files
```

### Common patterns
```bash
# Whole word match
rg -w "test"

# Show only filenames
rg -l "pattern"

# Show with context (3 lines before/after)
rg -C 3 "function"

# Count matches
rg -c "import"
```

## Advanced Usage

### File type filtering
```bash
# Multiple file types
rg "error" -t py -t js

# Exclude file types
rg "TODO" -T md -T txt

# List available types
rg --type-list
```

### Search modifiers
```bash
# Regex search
rg "user_\d+"

# Fixed string (no regex)
rg -F "function()"

# Multiline search
rg -U "start.*end"

# Only show matches, not lines
rg -o "https?://[^\s]+"
```

### Path filtering
```bash
# Search specific directory
rg "pattern" src/

# Glob patterns
rg "error" -g "*.log"
rg "test" -g "!*.min.js"

# Include hidden files
rg "secret" --hidden

# Search all files (ignore .gitignore)
rg "pattern" --no-ignore
```

## Replacement Operations

```bash
# Preview replacements
rg "old_name" --replace "new_name"

# Actually replace (requires extra tool like sd)
rg "old_name" -l | xargs sed -i 's/old_name/new_name/g'
```

## Performance Tips

```bash
# Parallel search (auto by default)
rg "pattern" -j 8

# Skip large files
rg "pattern" --max-filesize 10M

# Memory map files
rg "pattern" --mmap
```

## Common Use Cases

**Find TODOs in code:**
```bash
rg "TODO|FIXME|HACK" --type-add 'code:*.{rs,go,py,js,ts}' -t code
```

**Search in specific branches:**
```bash
git show branch:file | rg "pattern"
```

**Find files containing multiple patterns:**
```bash
rg "pattern1" | rg "pattern2"
```

**Search with context and color:**
```bash
rg -C 2 --color always "error" | less -R
```

## Comparison to grep

- **Faster:** Typically 5-10x faster than grep
- **Smarter:** Respects `.gitignore`, skips binary files
- **Better defaults:** Recursive, colored output, line numbers
- **Easier:** Simpler syntax for common tasks

## Tips

- `rg` is often faster than `grep -r`
- Use `-t` for file type filtering instead of `--include`
- Combine with other tools: `rg pattern -l | xargs tool`
- Add custom types in `~/.ripgreprc`
- Use `--stats` to see search performance

## Documentation

GitHub: https://github.com/BurntSushi/ripgrep
User Guide: https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md

「开发编程」分类下的热门技能

Arnarsson 的其他技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。