The grep module enhances the standard global regular expression search tool by integrating FZF, providing an interactive environment to search files and view results in real-time.
When to Activate
- When the user wants to search for text patterns within files or directories.
- When an interactive, searchable list of grep matches is required (
--fz). - When performing rapid code or log investigation via terminal.
Core Principles & Rules
- Interactive First: Use
--fzfapp(or defaultx grep) for a dynamic search experience. - Scripting Fallback: Supports the standard
grepflags for non-interactive use via thecmdsubcommand. - Context Support: Fully supports standard flags like
-A,-B, and-Cfor context lines.
Patterns & Examples
Interactive Search
# Start an interactive search in the current directory
x grep
Search via Pipe
# Pipe command output into an interactive grep session
x ascii | x grep
Search Specific Dir
# Open interactive TUI to search inside a specific path
x grep --fzfapp ~/.x-cmd.root
Checklist
- Confirm the search pattern or regex.
- Verify if an interactive view or standard output is preferred.
- Ensure the search scope (file or directory) is correctly targeted.