brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: RIPGREP_CONFIG_PATH gives ripgrep a config file for your usual flags

Config
~/tips/tip-config-ripgrep-config-path

--smart-case

Store the options you type every time in one file that rg reads.

If you type the same flags after rg all day, put them in a file. ripgrep doesn’t look for one on its own, so you tell it where to find it with an environment variable.

Create ~/.ripgreprc with one argument per line:

--smart-case
--glob=!node_modules/*
--max-columns=200

Then point ripgrep at it from your shell startup file:

export RIPGREP_CONFIG_PATH="$HOME/.ripgreprc"

Now a plain search follows those rules. With smart case, a lowercase pattern also finds capitals, and a pattern with a capital in it stays strict. Lines that start with # in the file are comments.

The format is strict about one thing: each line is a single argument. Write --max-columns=200 with the equals sign, or put the flag and its value on two lines. A line with a space in the middle is passed as one odd argument and fails.

When a result looks off, or you can’t find something you know is there, rule the file out first:

rg --no-config pattern

I’d also keep the file short. Hidden filters are easy to forget, and scripts that call rg on your machine pick up the same settings, so add --no-config in scripts that must behave the same everywhere.

Further reading: ripgrep user guide

Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more

More Config tips include extraconfig.txt root = true npm config list define( 'WP_HOME', 'https://example.com' ); jellyfin --cachedir /srv/jellyfin-cache All Config tips (9) All topics

Link