A Neovim plugin for interacting with the Pi coding agent.
- Terminal Mode: Open a terminal running the
picommand directly - RPC Mode: Connect to a running Pi agent via TCP RPC, with a chat-style interface
- Visual Selection: Select code and send it to the agent with a custom prompt
- Extension UI: Handle extension requests (select, confirm, input, editor dialogs)
- Neovim >= 0.9.0
- Pi coding agent installed (
picommand available, or a running RPC instance)
Using lazy.nvim:
{
"your-username/pi-nvim",
config = function()
require("pi-nvim").setup({
-- options (see Configuration below)
})
end,
}Using packer.nvim:
use {
"your-username/pi-nvim",
config = function()
require("pi-nvim").setup()
end,
}| Command | Description |
|---|---|
:PiAgent new |
Open a terminal running pi |
:vertical PiAgent new |
Open terminal in vertical split |
:PiAgent <port> |
Connect to RPC server on given port |
:PiAgent status |
Show current session status |
:PiAgent abort |
Abort current RPC operation |
:PiAgent reconnect |
Reconnect to RPC server |
| Mode | Keymap | Description |
|---|---|---|
| Visual | <leader>a |
Open prompt popup for selected text |
| Normal (in chat) | <CR> |
Submit prompt (when cursor in input area) |
| Insert (in chat) | <C-CR> |
Submit prompt |
| Any (in chat) | <C-c> |
Abort current operation |
- Run
:PiAgent newto open a terminal with the Pi agent - Interact directly with the terminal
- Use
<leader>piin visual mode to send selected code with a prompt
- Start Pi agent with RPC:
pi --rpc --port 9999 - In Neovim:
:PiAgent 9999 - Type prompts in the input area at the bottom
- Press
<CR>to submit - Use
<leader>piin visual mode to send selected code with a prompt
require("pi-nvim").setup({
-- RPC connection settings
host = "127.0.0.1",
default_port = 9999,
-- UI settings
split_direction = "horizontal", -- "horizontal" or "vertical"
filetype = "pi", -- filetype for chat buffer
-- Terminal settings
pi_command = "pi",
-- Visual selection prompt format
-- Available placeholders: {file}, {start_line}, {end_line}, {filetype}, {selection}, {prompt}
prompt_format = "In file `{file}` lines {start_line}-{end_line}:\n```{filetype}\n{selection}\n```\n\n{prompt}",
-- Keymaps
keymaps = {
visual_prompt = "<leader>pi", -- set to nil to disable
},
})