The rg module provides a powerful CLI for ripgrep, one of the fastest search tools available. It enhances the experience by adding an interactive FZF application for real-time searching and filtering.
When to Activate
- When the user needs to search for text patterns recursively across directories.
- When an interactive, searchable TUI is required for exploring code search results.
- When searching within compressed files (
-z). - When performing multi-line regex matching.
Core Principles & Rules
- High Performance: Emphasize that it handles large datasets efficiently.
- Interactive Mode: Use the default
x rg(or--fzfapp) for a dynamic search experience. - Convenient Shortcuts: In interactive mode, use
alt-ato select all orctrl-oto edit matches.
Additional Scenarios
- File Type Filtering: Use
-tto limit search to specific file types (e.g.,python,js). - Structured Data: Supports
--jsonfor programmatic result processing.
Patterns & Examples
Interactive Search
# Start an interactive search in the current directory
x rg
Search Specific Directory
# Open interactive TUI to search inside a specific path
x rg --fzfapp ~/.x-cmd.root
Search Compressed Files
# Recursively search for patterns inside .zip or .gz files
x rg -z "search pattern"
Checklist
- Confirm the search pattern or regex.
- Verify if an interactive or standard output is preferred.
- Check if the search should be limited to specific file types or depths.