May 29, 2026

Ripgrep

This actually has little to do with Vim, but I learned about ripgrep from the book "Modern Vim".

For some time, I have had my own script called "rgrep" that looks like this:

#!/bin/sh
grep -r $1 .
I use it all the time. It is of course ridiculously simple, but it is worth it to save a few keystrokes for something you do frequently.

What about ripgrep

I already have this on my system (Fedora 43) and it is invoked as "rg". We are already saving more keystrokes. By default it does a recursive search, which is already good. It ignores files in my .gitignore file, which sounds good. This is especially good for the file "tags" that is generated by ctags and which clogs up my use of regular grep.

By default ripgrep generates headers (including a blank line) which I am not fond of. It also includes line (and column) numbers! This apparently is useful for some kind of vim integration, but is not what I want at this time.

Of course ripgrep has a variety of command line arguments, and I could set up a wrapper script for it and include all of those. A better way is to use a configuration file (.ripgreprc), but oddly enough this is ignored unless you add a line like this to your .bashrc:

export RIPGREP_CONFIG_PATH="$HOME/.ripgreprc"
This file simply has a single command line argument per line. The following 2 line config file does the job:
--no-heading
--no-line-number
There is a --no-column flag, but apparently specifying --no-line-number gets rid of column numbers as well. Or maybe I just wasn't getting them in the first place.


Have any comments? Questions? Drop me a line!

Tom's vim pages / tom@mmto.org