Config and Shell Integration

Persist preferred flags, create custom types, and combine ripgrep with fd, fzf, git, and editors.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Config files
Point ripgrep at a config file
export RIPGREP_CONFIG_PATH="$HOME/.ripgreprc"

# Set a path that ripgrep reads for default arguments.

Sample ripgrep config contents
--smart-case
--hidden
--glob
!node_modules/**

# Example settings for smart case and hidden files.

Define a custom type in config
--type-add
web:*.{html,css,js,ts,tsx}

# Persist custom type mappings across sessions.

Ignore the config for one invocation
rg --no-config 'token' .

# Run ripgrep without loading config defaults.

Debug config-driven behavior
rg --debug 'TODO' .

# Inspect the effective path filtering and search decisions.

## Git and toolchain workflows
Search tracked files only
git ls-files -z | xargs -0 rg 'TODO'

# Restrict ripgrep to files known to git.

Search only changed files
git diff --name-only main...HEAD | rg '\.ts$'

# Pipe a changed-file list into ripgrep.

Find candidate files with fd, then search with rg
fd -e ts -e tsx src | xargs rg 'useQuery\('

# Combine fast file discovery with fast content search.

Use ripgrep for live fuzzy-finder reloads
fzf --bind 'change:reload:rg --line-number --no-heading --color=always {q} . || true'

# Power an interactive search UI in fzf.

Open ripgrep results in Vim quickfix
vim -q <(rg --vimgrep 'TODO' .)

# Feed matches into an editor workflow.

## Editor-friendly formats
Emit vimgrep-style results
rg --vimgrep 'panic!' src/

# Print `file:line:column:text` output for editors.

Use simple no-heading output
rg --no-heading --line-number --column 'FIXME' .

# Produce a stream of one match per line.

Use JSON for custom tooling
rg --json 'router' src/ | jq

# Feed structured matches into a script or app.

Disable ANSI color for downstream tools
rg --color=never 'TODO' .

# Prevent escape sequences from breaking consumers.

Force colors through a pager
rg --color=always 'panic!' src/ | less -R

# Keep syntax highlighting in paged output.

Recommended next

No recommendations yet.