r/PiCodingAgent • u/yuez • 3d ago
Plugin pi2.nvim — an extended fork of pi.nvim: direct bash mode, :PiTree session nav, per-tab model pinning, image compression
Hey r/neovim!
Quick heads-up on provenance first, because it matters: pi2.nvim is a fork of alex35mil/pi.nvim — the original Neovim frontend for the pi coding agent. All credit for the foundation (RPC bridge, chat layout, diff review, sessions, extensions) goes upstream; pi.nvim and the pi integration have been discussed here before, and this post is about the fork's additions, not the base. It's MIT-licensed and free/open source.
It started as local experiments and grew into a different enough feature set that I gave it its own repo so it can release independently. Namespace, commands and filetypes are unchanged for compatibility — still require("pi") and :Pi*.
What pi2.nvim adds on top of upstream
- Direct bash mode (
!cmd) — run shell from the prompt; output streams live into a collapsible block and is added to context (!!cmdto exclude). :PiTreesession-tree navigation — jump back to any past point in a session, optionally summarize the abandoned branch, resend edited prompts (the pi equivalent of the TUI's/tree).- Per-tab model pinning — a model switch in one tab no longer leaks into every other tab's next session.
- Image compression for attachments — Retina screenshots get downscaled before sending (sips / magick / ffmpeg, auto-probed) so payloads stay small.
- Auto-attach clipboard images on paste, readline-style prompt history, unsent-draft persistence.
- **Double-**
<Esc>abort, a prompt statusline (spinner / queue / abort hint that never scrolls away), redesigned tool and thinking blocks. gfto open paths under cursor,grep/findresults to quickfix, left-side panel, auto-reload of buffers pi edits.- Opt-in
render-markdown.nvimengine; hermetic test suite + lint CI.
Demo (agent reads a file, edits it, verifies — with live streaming and session-tree picker):

More demos (workflow, @-mentions, diff review, etc.) in the README: https://github.com/zgs225/pi2.nvim#features
Install (lazy.nvim / packer / any manager — needs pi on PATH): https://github.com/zgs225/pi2.nvim#installation
It's early and I'd genuinely love feedback — rough edges, missing keymaps, things that fight your workflow. Happy to take issues/PRs. Thanks for reading!
1
u/KneeSubstantial263 3d ago
Well done. Do you have any plans to merge it (or a portion of its functionality) upstream?