A herdr plugin: live-grep your repo with fzf + ripgrep,
then open the match in nvim — in a split beside your work. Press the key, type,
watch results stream in with a bat preview, hit Enter, and you land in nvim on the
exact line. Quit nvim (or press Esc) and the split closes itself.
It never edits your files and runs nothing on its own — it only opens an editor on the file you pick.
Repo: https://github.com/cinco/herdr-grep-nvim · install with herdr plugin install cinco/herdr-grep-nvim · issues & PRs welcome
- herdr ≥ 0.7.0 (the plugin system)
- fzf ≥ 0.35 — the picker
- ripgrep (
rg) — the search - nvim (or any editor that accepts
+LINE file; see Configuration) - bat — optional, for a syntax-highlighted preview (falls back to plain text)
- Linux or macOS
Your pane shell can be bash, zsh, or fish — the plugin's scripts run under bash
(via their shebang) regardless of your login shell, so nothing here is shell-specific.
herdr plugin install cinco/herdr-grep-nvimThat registers the grep-nvim.open action. Then bind a key in your herdr config
(~/.config/herdr/config.toml) so one press summons it:
[[keys.command]]
key = "prefix+alt+f"
type = "shell"
command = "herdr plugin action invoke grep-nvim.open"Run herdr server reload-config, then press your key. No key bound? Invoke it once with:
herdr plugin action invoke grep-nvim.open- Press the key inside a git repo / project you're working in.
- A pane splits to the right (at that repo's path) with a
grep>prompt. - Type — ripgrep searches as you go; the match preview shows on the right.
- Enter on a result opens it in nvim at that line.
- Quit nvim (
:q) — or press Esc in the picker — and the pane closes.
All optional, via environment variables (set them in your shell profile, or per herdr pane):
| Variable | Default | Effect |
|---|---|---|
GREP_NVIM_EDITOR |
nvim |
Editor to open the match. Must accept +LINE -- file (vim/nvim). Word-split like $EDITOR, so it may include args (e.g. nvim -u NONE); a binary path containing spaces needs a wrapper. |
GREP_NVIM_RG_FLAGS |
(none) | Extra ripgrep flags, e.g. --hidden -g '!.git' or -t py. |
GREP_NVIM_DIRECTION |
right |
Split direction: right or down. |
Pure shell — no compiled binary, no build step:
herdr-plugin.tomldeclares one action,open.scripts/open.shreads the focused pane's cwd fromHERDR_PLUGIN_CONTEXT_JSON, splits that pane (herdr pane split --cwd <repo> --env GREP_NVIM_SCRIPT=… --focus), thenexecs the picker in the new pane so quitting the editor closes the pane.scripts/fzf-grep-nvim.shrunsfzf --disabledwith achange:reloadbind that re-runsrgper keystroke. On Enter, fzf prints the selectedpath:line:col:textline; the script recovers the path and line in the shell (robust to colons in the path) andexecs the editor at that line.
herdr plugin link /path/to/herdr-grep-nvim # use this checkout directly (skips build)
herdr plugin action list --plugin grep-nvim
herdr plugin action invoke grep-nvim.open
herdr plugin log list --plugin grep-nvim # see stderr from the actionThis plugin lives at https://github.com/cinco/herdr-grep-nvim and carries the GitHub
topic herdr-plugin, so herdr's marketplace (https://herdr.dev/plugins/) indexes
it automatically — there is no review queue, and the index refreshes ~every 30 min.
Forking it? To list your own copy: push a public GitHub repo containing
herdr-plugin.toml, add the topic herdr-plugin, and install it with
herdr plugin install <your-user>/<your-repo>.
MIT — see LICENSE.
