Nine is a Neovim plugin that uses pi RPC mode to generate text to insert at the current cursor position or replacement text for a visual selection.
It is directly inspired by ThePrimeagen/99 and is my take on the idea using the more minimal pi coding agent.
Nine supports two workflows:
- Normal mode
:Nineopens a floating prompt for text to insert at the cursor. - Visual mode
:'<,'>Nineopens the same prompt for rewriting the selected text. - Neovim applies the returned text in a single buffer mutation.
- In visual mode, only the selected range is replaced; text around the selection is immutable context.
pimust be installed and available on$PATH- Neovim with Lua support
It is not required to call setup, but if you want to modify the options, these are the defaults:
require("nine").setup({
pi_cmd = "pi",
pi_args = { "--mode", "rpc", "--no-session", "--tools", "read,grep,find,ls" },
})For insertion, run:
:NineFor visual replacement, select text and run:
:'<,'>NineExample Lua keymaps:
vim.keymap.set("n", "<leader>nn", "<cmd>Nine<cr>", { desc = "nine insert" })
vim.keymap.set("x", "<leader>nn", ":Nine<cr>", { desc = "nine rewrite selection" })Inside the prompt window:
<C-d>submits in insert and normal mode<Esc>cancels in normal mode
Run the headless Neovim test suite:
./tests/run.shTest output is colored by default. Disable ANSI colors with:
NO_COLOR=1 ./tests/run.sh- Nine keeps
piread-only for these workflows. - Neovim is the only part that mutates the buffer.
- Insertions and replacements are applied with one
nvim_buf_set_text()call so they land as a single undo step.
See plan.md for the v1 design.