AI-powered code editing for Neovim, powered by Pi.
- Select code in visual mode (
Vthenjj) - Press
<leader>ea - A small input box appears right below the cursor — type what you want done
- The selection highlights and a spinner animates at the end of the line
- Pi processes the request → replacement is applied inline
- The spinner turns into ✓ done and fades away
- No buffer content is modified except the edit itself
- Neovim 0.9+
- Pi CLI installed globally:
npm install -g @earendil-works/pi-coding-agent - An API key for an LLM provider configured for Pi
{
"your-username/etch.nvim",
config = function()
require("etch").setup({
keybind = "<leader>ea",
model = "opencode/deepseek-v4-flash-free", -- or nil for Pi default
})
end,
}use({
"your-username/etch.nvim",
config = function()
require("etch").setup()
end,
})require("etch").setup({
-- Visual mode keybinding
keybind = "<leader>ea",
-- Pi model to use
-- e.g. "opencode/deepseek-v4-flash-free", "anthropic/claude-sonnet-4-20250514"
-- nil = use Pi's default model
model = nil,
})Visual select code → press <leader>ea
│
▼
Inline input box (1 line, right below cursor)
│
User types instruction → Enter
│
▼
Selection highlighted + spinner animates at end of line
│
▼
Lua writes prompt to temp file (full context + selection + instruction)
│
▼
pi -p --model <model> < prompt.txt
│
▼
Spinner → ✓ done → edit applied → marker fades
etch.nvim/
├── lua/etch/
│ ├── init.lua # Entry point, keybinds, visual selection
│ ├── ui.lua # Inline input box near cursor
│ └── runner.lua # Spawns pi -p, spinner UI, parses result
└── README.md
| SDK | pi -p |
|
|---|---|---|
| Startup | ~2-5s (imports + session init) | ~0.01s |
| Deps | 140+ npm packages | None (pi is global) |
| Complexity | Events, tools, sessions | stdin → stdout |
| Our use case | Overkill | Perfect fit |
For a single-turn "edit this selection" task, pi -p is dramatically simpler and faster.
MIT