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
累計下載
4068
星標
1
全站排名
#2,491
全站前 50% · 「開發程式設計」前 56%
平台累計安裝累計下載星標評論
ClawHub ↗12538061-
SkillHub ↗14740681—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

隱藏檔案或忽略規則覆蓋選項可能搜尋到私密或生成檔案;執行前應檢查搜尋路徑、檔案篩選和忽略引數。替換示例可能批次就地修改檔案,應先預覽並縮小範圍,且在執行前準備好備份或版本控制恢復方案。 需要 rg 命令;原地修改需藉助其他編輯工具。

資料釋出於 2026-10-29

可以用來做什麼

  • 在程式碼庫中搜尋指定文字或正規表示式
  • 按檔案型別篩選並檢視匹配上下文
  • 預覽替換候選後整理批次修改計劃

什麼時候用

  • 搜尋路徑和目標檔案範圍已確認時
  • 可能命中私密或生成檔案的選項已逐項審閱時
  • 任何替換都先預覽並限定路徑、檔案型別時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

規劃一條只搜尋指定目錄內原始碼的命令,並說明如何避免讀取忽略檔案;不要執行搜尋或替換。

月度資料趨勢

累計下載4068
2552336641802026-03 · 累計下載 26642026-05 · 累計下載 31602026-06 · 累計下載 33182026-07 · 累計下載 35652026-08 · 累計下載 36922026-09 · 累計下載 406826-0326-09
星標1
0122026-03 · 星標 12026-05 · 星標 12026-06 · 星標 12026-07 · 星標 12026-08 · 星標 12026-09 · 星標 126-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。 該技能有同名的其他版本,調整前的資料歸屬當前下載量最大的這一個。

月份累計下載環比星標
2026-094068—1
2026-083692+3.6%1
2026-073565+7.4%1
2026-063318+5.0%1
2026-053160—1
2026-032664—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),按月更新。口徑說明見資料方法。