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

Store your default rg behavior in a reusable config file.

Point ripgrep at a config file

Set a path that ripgrep reads for default arguments.

bashANYripgrepconfig
bash
export RIPGREP_CONFIG_PATH="$HOME/.ripgreprc"
Notes

ripgrep reads the file specified by `RIPGREP_CONFIG_PATH` and applies each argument line automatically.

Sample ripgrep config contents

Example settings for smart case and hidden files.

txtANYripgrepconfigsample
txt
--smart-case
--hidden
--glob
!node_modules/**
Notes

Each line in the config file is one argument; comment lines can begin with `#`.

Define a custom type in config

Persist custom type mappings across sessions.

txtANYripgreptype-addconfig
txt
--type-add
web:*.{html,css,js,ts,tsx}
Notes

Putting `--type-add` in config saves you from repeating it on every command.

Ignore the config for one invocation

Run ripgrep without loading config defaults.

bashANYripgrepno-config
bash
rg --no-config 'token' .
Notes

This is useful when debugging an alias or a surprising default behavior.

Debug config-driven behavior

Inspect the effective path filtering and search decisions.

bashANYripgrepdebugconfig
bash
rg --debug 'TODO' .
Notes

`--debug` is the quickest way to see whether config options are affecting the search.

Git and toolchain workflows

Combine rg with git, fd, fzf, and editors for faster navigation and refactors.

Search tracked files only

Restrict ripgrep to files known to git.

bashANYripgrepgittracked
bash
git ls-files -z | xargs -0 rg 'TODO'
Notes

This avoids build output, vendored folders, and untracked scratch files.

Search only changed files

Pipe a changed-file list into ripgrep.

bashANYripgrepgitchanged
bash
git diff --name-only main...HEAD | rg '\.ts$'
Notes

This is a quick way to focus on the files touched in a branch.

Find candidate files with fd, then search with rg

Combine fast file discovery with fast content search.

bashANYripgrepfdxargs
bash
fd -e ts -e tsx src | xargs rg 'useQuery\('
Notes

`fd` is great at path selection while ripgrep excels at content matching.

Use ripgrep for live fuzzy-finder reloads

Power an interactive search UI in fzf.

bashANYripgrepfzfinteractive
bash
fzf --bind 'change:reload:rg --line-number --no-heading --color=always {q} . || true'
Notes

A classic terminal setup for IDE-like project search.

Open ripgrep results in Vim quickfix

Feed matches into an editor workflow.

bashANYripgrepvimquickfix
bash
vim -q <(rg --vimgrep 'TODO' .)
Notes

`--vimgrep` formats output specifically for Vim quickfix and similar tools.

Editor-friendly formats

Use output shapes built for editors and jump lists.

Emit vimgrep-style results

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

bashANYripgrepvimgrep
bash
rg --vimgrep 'panic!' src/
Notes

Many editors can parse vimgrep format directly.

Use simple no-heading output

Produce a stream of one match per line.

bashANYripgrepeditoroutput
bash
rg --no-heading --line-number --column 'FIXME' .
Notes

This general-purpose format works in many homegrown tools and scripts.

Use JSON for custom tooling

Feed structured matches into a script or app.

bashANYripgrepjsoneditor
bash
rg --json 'router' src/ | jq
Notes

JSON output avoids brittle splitting on colons or spaces.

Disable ANSI color for downstream tools

Prevent escape sequences from breaking consumers.

bashANYripgrepcolor
bash
rg --color=never 'TODO' .
Notes

Disable colors when the destination is not a terminal.

Force colors through a pager

Keep syntax highlighting in paged output.

bashANYripgrepcolorpager
bash
rg --color=always 'panic!' src/ | less -R
Notes

`less -R` preserves raw ANSI colors in paged results.

Recommended next

No recommendations yet.