Fast code search in huge repos: my ripgrep + fzf workflow for monorepos

A practical, low-cost workflow using ripgrep, fzf and bat to do fast code search in large monorepos on modest machines.

Written by: Rohan Deshpande

Developer typing on a laptop with code on the screen and a cup of coffee nearby
Image credit: Unsplash

When your repo grows past a few hundred megabytes, the tiny “Find in Files” that used to save you starts to feel like molasses. I’ve been there — large monorepos, limited RAM on a work laptop bought in India, and intermittent internet that makes cloud-based search tools feel like a luxury. Over the last two years I landed on a practical, offline workflow that gets me to the right file in seconds: ripgrep + fzf + bat.

This isn’t a magic solution for every situation, but it’s fast, cheap, and—critically—works well on a mid-range laptop. Below I explain the pieces, a small shell function you can drop into your shell, and the tradeoffs to expect.

Why this combo?

Together they deliver a simple, keyboard-first “fast code search” experience that feels like using an IDE search but without the memory footprint.

What I actually run Install ripgrep, fzf, and bat via your package manager (apt, pacman, Homebrew, or Scoop/WSL on Windows). On my Ubuntu laptop (8–16GB RAM typical for many devs in India) this is lightweight and snappy.

Here’s a stripped-down shell function I use (works in bash/zsh):

search() { local query=“$1” if [ -z “$query” ]; then echo “Usage: search ” return 1 fi

rg —line-number —hidden —no-ignore-vcs —glob ‘!.git/
—glob ‘!node_modules/
’ —glob ‘!dist/’ —glob ‘!build/
—color=always “$query”
| sed -E “s/(:[^:]+:)/\1\x1b[0m/”
| fzf —ansi —delimiter : —nth 3..
—preview ‘bat —style=numbers —color=always —highlight-line {2} {1}’
—bind ‘enter:execute(vim +{2} {1})’ }

Drop it into .bashrc or .zshrc. Usage: search TODO or search MyClassName.

How it feels in practice

A few practical tweaks I lean on

Why I prefer this over cloud or indexed tools

Real tradeoffs (so you know the limits)

A realistic workflow example Say you’re debugging a flaky feature and you remember the environment variable name but not where it’s read. You run:

search “FEATURE_X_ENABLED”

Within seconds you have occurrences across services, quickly preview context with the arrow keys, and jump into the one that shows how it’s parsed. No waiting for a server-side index to catch up; no extra cost.

Tuning for Indian constraints If your machine is modest (4–8GB RAM), avoid opening too many editor instances from fzf; prefer a single editor and reuse buffers. If your office bandwidth is capped or unreliable, this offline approach keeps you productive without bringing up remote tools.

Parting advice This setup won’t replace an IDE’s deep static analysis, but it’s the fastest way I know to find the right file or line in a noisy monorepo when time matters. The biggest win is velocity: fewer context switches, less waiting, and a keyboard flow that keeps your hands where the work happens.

Try it for a week. Tweak the globs to suit your repo, add aliases for service roots you work on, and accept that sometimes you’ll need a semantic tool for really hard cross-repo problems. For everyday debugging and exploration, this “fast code search” combo saves me minutes every day — and those add up.

Good luck, and if you want, tell me what your repo looks like and I’ll suggest globs and a tuned function that fits it.