Send code from Neovim to a coding agent running in herdr
  • Lua 98.7%
  • Makefile 1.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jonathan Warykowski 06ba74fe7a
All checks were successful
CI / lint (push) Successful in 54s
CI / test (nightly) (push) Successful in 1m15s
CI / test (stable) (push) Successful in 1m12s
refactor!: keybars Pro's side moves to keybars.nvim (#7)
2026-10-18 05:22:49 +00:00
.github/workflows ci: run on Forgejo Actions (#5) 2026-10-14 12:52:05 +00:00
assets docs: new icon, centred above the README (#4) 2026-10-13 21:42:39 +11:00
lua/herdr refactor!: keybars Pro's side moves to keybars.nvim (#7) 2026-10-18 05:22:49 +00:00
tests refactor!: keybars Pro's side moves to keybars.nvim (#7) 2026-10-18 05:22:49 +00:00
.busted feat: send code from Neovim to a herdr agent 2026-10-11 01:16:36 +11:00
.luacheckrc feat: send code from Neovim to a herdr agent 2026-10-11 01:16:36 +11:00
.stylua.toml feat: send code from Neovim to a herdr agent 2026-10-11 01:16:36 +11:00
LICENSE feat: send code from Neovim to a herdr agent 2026-10-11 01:16:36 +11:00
Makefile feat: send code from Neovim to a herdr agent 2026-10-11 01:16:36 +11:00
README.md refactor!: keybars Pro's side moves to keybars.nvim (#7) 2026-10-18 05:22:49 +00:00

herdr.nvim

herdr.nvim

Send code from Neovim to a coding agent running in herdr, without leaving the editor.

Select some lines, run :HerdrSend, type what you want ("why does this panic?", "add a test for this"), and the agent in the next pane gets your instruction plus file:line and the code in a fenced block, along with any diagnostics on those lines. Works with any agent herdr runs: Claude Code, Codex, OpenCode, and others.

requirements

  • Neovim ≥ 0.11 (vim.system, vim.ui).
  • herdr, with nvim running inside a herdr pane and an agent in another pane of the same workspace.

install

lazy.nvim:

return {
	"jwarykowski/herdr.nvim",
	cmd = { "HerdrSend", "HerdrFocus" },
	keys = {
		{ "<leader>ai", "<cmd>HerdrSend<cr>", desc = "agent: ask about this line" },
		{ "<leader>ai", ":HerdrSend<cr>", mode = "x", desc = "agent: ask about selection" },
		{ "<leader>aI", "<cmd>HerdrSend!<cr>", desc = "agent: ask, picking the agent" },
		{ "<leader>af", "<cmd>HerdrFocus<cr>", desc = "agent: focus its pane" },
	},
	opts = {},
}

Other plugin managers: add the repo and call require("herdr").setup().

usage

  • :HerdrSend — prompt for an instruction and send it with the cursor's file:line to an agent. With a range (:'<,'>HerdrSend, or from visual mode) it sends file:first-last and the lines in a fenced block.
  • Agent choice: with one agent in the workspace it goes straight there; with several you pick, and later sends reuse that agent while it is still running. :HerdrSend! picks again.
  • Diagnostics (errors, warnings) on the sent lines are appended, so "fix this" needs no copy-pasting.
  • :HerdrFocus — jump to the agent's pane (the last one sent to, else pick); :HerdrFocus! picks.

The pane nvim runs in is never offered, so an agent running nvim can't prompt itself.

Run :checkhealth herdr to check the binary, the pane, and herdr agent list.

configuration

require("herdr").setup({
	cmd = nil, -- herdr binary; default $HERDR_BIN_PATH, else herdr on $PATH
	diagnostics = true, -- append diagnostics on the sent lines
	scope = "workspace", -- or "all": offer agents from every herdr workspace
})

keybars Pro

With keybars Pro, keybars.nvim puts the editor's work on the keyboard: :KeybarsRun shows a build there, errors can hold a key, and the statusline shows Focus and typing speed.

development

make fmt     # stylua
make lint    # stylua --check + luacheck
make test    # busted (specs run under Neovim via nlua)
make check   # lint + test

Test deps: luarocks install busted nlua. The specs cover the pure helpers (agent filtering, labels, the prompt and context format, agent choice) exposed on require("herdr")._internal; CI runs them on Neovim stable and nightly.

support

herdr.nvim is free and MIT licensed. If it saves you some copy and paste, you can sponsor its development.

license

MIT