Send code selections from Neovim into a pi prompt without copy-pasting.
Yank code with :ClankerYank in nvim → a [+ path:lines] token appears in
your pi prompt → submit → pi sees the full code block expanded inline.
Status: works on
localhost. Not packaged for distribution yet. See~/project-ideas/clankeryank-v2-nvim-rpc.mdfor the planned v2 redesign that drops the HTTP server.
┌──────────┐ POST /append-block ┌──────────────┐
│ Neovim │ ───────────────────► │ Rust server │
│ :CY cmd │ │ (axum, 3000) │
└──────────┘ └──────┬───────┘
│ GET /get-context?since=N
▼
┌──────────────┐
│ pi extension │
│ (polls 1s) │
└──────┬───────┘
│ injects [+ path:lines] token
│ into the prompt editor
▼
user types → submits
│
tokens expanded → fenced code → sent to LLM
│
DELETE /context, reset state
Three runtimes, one direction of data flow per step. The pi extension is the only component that mutates editor state.
| Path | What it is |
|---|---|
nvim/ |
Lua plugin — registers :ClankerYank / :CY |
pi-extension/ |
TypeScript pi extension — polls, injects, expands |
server/ |
Rust HTTP server — holds the accumulated blocks |
- Rust 1.75+ (
cargo) - Neovim 0.10+ (uses
vim.system) - pi v? (whatever version exposes
addAutocompleteProviderand theinputevent — current as of 2026)
cd server
cargo run
# expect: listening on 127.0.0.1:3000Keep this running in a terminal. There is no daemonization yet.
Drop nvim/lua/user/clankeryank.lua onto your runtimepath and require it.
For a chezmoi-managed config:
cp nvim/lua/user/clankeryank.lua ~/.config/nvim/lua/user/clankeryank.luaOr symlink during development:
ln -s "$PWD/nvim/lua/user/clankeryank.lua" ~/.config/nvim/lua/user/clankeryank.luaIn your init.lua:
require("user.clankeryank")Pi auto-discovers extensions from ~/.pi/agent/extensions/<name>/index.ts.
Symlink the extension directory:
ln -s "$PWD/pi-extension" ~/.pi/agent/extensions/ClankerYankRestart pi (or /reload). You should see a toast: connected to server.
- In nvim, visually select a range and run
:ClankerYank(or:CY). - Within ~1s, a token like
[+ /path/to/file.rs:10-25]appears in your pi prompt. - Repeat for as many ranges as you want. Multiple files, multiple ranges.
- Type the rest of your prompt around the tokens.
- Submit. Pi expands each token to a fenced code block before sending to the LLM, then clears the server.
- Polls every 1s; up to 1s of latency between
:CYand the token appearing. - Hardcoded TCP port
127.0.0.1:3000. - Single global state on the server — two pi sessions or two nvim instances will stomp on each other.
- The server has no persistence; restart it and you lose any pending blocks.
- No
--detachon the nvim curl call; very slow servers could briefly block:CY. - Tokens use absolute paths and can get long. Project-relative paths are a planned polish.
The pi extension's debug ctx.ui.notify calls in resolveHttpServer are
loud. Gate them on a DEBUG flag or remove before sharing.
To iterate on the pi extension without restarting pi, use /reload.
To iterate on the nvim plugin, :source % after editing.
To iterate on the server, cargo run re-builds and re-binds the port (kill
the old process first).
TBD.