Projects

herdr-nav

File navigation, code search and Java debugging inside a terminal workspace. One shell script, one keybinding worth remembering.

2 min readshipped
Repo
github.com/karanpatel1993/herdr-nav★ 2
Stack
Shell · fzf · ripgrep · ast-grep · jdb

A colleague at work put me onto herdr last month and it’s completely changed how I work with agents and worktrees.

What I didn’t expect was that I’d slowly stop opening IntelliJ. I was writing less and less code in it — mostly opening it to look at a file here and there, or to debug something. And IntelliJ, as we all know, eats RAM for breakfast. One instance per worktree, each building its own index, and a few open at once is enough to get the fans going.

So: why not just do this in the terminal?

The menu, filtered as you type

Finding files is fzf. Searching code is ripgrep. Java gets ast-grep, which actually parses the code instead of regexing it, so a variable name sitting in a comment doesn’t turn up in your results. All of it scoped to the git worktree of whichever pane you’re in — which matters more than it sounds, because otherwise every search hands you the same file from five different branches.

Find in files, with preview

Debugging is jdb attached to a running service, and you set breakpoints by browsing to a file instead of typing out fully-qualified class names.

jdb stopped at a breakpoint

One shell script. My setup is now a multi-pane terminal and nothing else.

One key

prefix+Space opens a menu of everything, filtered as you type. The individual bindings are the same actions once you know which one you reach for:

Key Opens
prefix+Shift+O go to file
prefix+Shift+C go to class
prefix+Shift+F find in files
prefix+Shift+E recent files
prefix+Shift+V project tree
prefix+Shift+B set breakpoints by browsing a file
prefix+Shift+S attach jdb to a service

Finding usages, callers and definitions lives in the menu, and on Ctrl+R / Ctrl+] once a file is open — which is where you actually want them.

What it can’t do

With ast-grep installed, Java search actually parses the code, so a name sitting in a comment or a string can’t match. Without it you’re back to regex and things get noisy.

Either way it’s syntax-aware, not type-aware. It can’t tell your status from some other class’s status, overloads all look the same, and interface dispatch, reflection, Lombok and anything inside a jar are invisible to it.

So: zero results means “not found”, not “dead code”. Worth remembering before you go deleting something. doctor tells you which engine is actually running.

Install

curl -fsSL https://raw.githubusercontent.com/karanpatel1993/herdr-nav/main/install.sh | sh

Everything it needs goes into ~/.local/bin — no admin rights, and nothing already on your PATH gets touched. There’s a herdr plugin route too if you’d rather herdr managed the files.

Linux and macOS. Windows needs WSL.