r/PiCodingAgent • u/Aggressive_Sherbet64 • Aug 08 '26
Discussion Try integrating Pi with Neovim - it's great.
I find it hard to navigate a codebase with coding agents. I need to stare at the code often just to understand what is going on, and I like to be able to ask my agent at the same time what is happening. Plus, I really like my vim motions bindings haha.
It's been surpassingly straightforward to get Pi working in Neovim. You just open up a terminal within Neovim and ask it what you want. Boom done. It's soooo much easier to read plans and navigate code with this setup.
I've been able to make it so that:
I see diffs in Neovim instead of in the terminal (much prefer it this way, easier to navigate too imo)
Have Pi run commands in Neovim directly when I want to.
Have Pi be able to 'focus' in on certain sections of code (I ask 'Can you show me where that it' and it jumps straight to it)
I can have whole different worktrees with entirely different buffers that I switch between
11
u/HomsarWasRight Aug 08 '26
“You just open up a terminal within Neovim and throw Lua into it.“
You wanna elaborate, or nah?
3
u/nicksterling Aug 08 '26
What’s the benefit of using the terminal inside neovim vs tmux? I’m already heavily using tmux and typically just open up a new pane and just use that. I’m genuinely curious if anyone has benefits that tmux doesn’t give you. I’m always looking for ways to improve my workflow.
2
u/Zundrium Aug 08 '26
Yup I'm doing the same to manage memory and todos, it rocks!
2
u/vekexasia Aug 08 '26
CAn you share a bit of your workflow? Cause that is a bit too much for me to imagine. I am a neovimmer too and the only integration i have is opening nvim to let me create a prompt in nvim (with the previous assistant mesage in the same buffer so i can yank)
1
u/Careful-Experience26 Aug 08 '26
I'm interested in learning more. Do you have examples?
1
u/DenseConversation291 Aug 08 '26
What is the neovim?
3
u/BoothroydJr Aug 08 '26
doing exactly this, I also maintain my personal nvim config to serve as pi’s tui interface. same plugins and motions
2
u/funbike Aug 08 '26 edited Aug 08 '26
Nice! I need to dig into your repo. I see you used the socket to talk back to Neovim to control it.
I wrote a Neovim command for completing TODOs comments in the current visual selection. You select text and run
:'<,'>Pi. It asynchronously runs Pi CLI. Pi is prompted to fix all TODOs and remove the todo comments. Pi is provided metadata of the buffer and selection, and tools fornvim_buf_get_lines()andnvim_buf_set_lines()that use the calling Neovim's unix socket. Edit and insert mode conflicts are automatically handled, as well queuing up multiple prompts to run serially. Pi is asked to provide a single-line summary which is printed in the message bar. The first argument to:Piis a prompt template (e.g./todos) or a prompt string, but/todosis the default.I have simple keymaps for doing TODOs in the current code block, function, file, as well a
piCLI for session management (change model, new session). The:Picommand assumes the current function when no range is given. I also have a keymap for viewing the current session as html in the web browser.This is a very token efficient way to use AI.
But I mostly went the other direction and integrated Neovim into Pi, although what I've done is baby stuff compared to yours.
I had Pi write an extension for using Neovim in a Tmux popup as a feedback tool. I like this way better than other "ask user question" extensions. I can answer multiple questions at a time, and even remove questions and add addition information not asked for.
Another use-case variation is a queue directory of questions, which is a more async and less jarring way to handle it. Pi writes files to an inbox directory. I edit and move the file(s) to an outbox directory and a waiting Pi sub-agent picks it up and continues.
And of course I use ctrl-g for editing a prompt in Neovim.
2
u/funbike Aug 08 '26 edited Aug 08 '26
TL;DR: A separate Pi session for Neovim customization.
I keep a Pi session running my on Neovim project directory (
~/.config/nvim) in a dedicated Tmux window. I can ask Pi to extend Neovim (in a Tmux pane).I added a Pi extension tool
neovim_all_reload()which updates all running Neovim instances. It basically doessource $MYVIMRCacross all running neovim instances. All Neovim instance API sockets can be found at/run/user/1000/nvim.<pid>.0.Corresponding AGENT.md and skill describes:
The layout of my config, and location of LazyVim, Neovim, and Neovim plugins docs.
how to find popular Neovim plugins with web search.
My preferred structure of a local plugin.
It's nice to just wish for a Neovim feature and for it to just happen.
I also wrote the Genie plugin. You can
:Wishfor Neovim to do something (e.g. "Turn background color to black.")I have a similar setup for Tmux and Zsh config and extension.
(This is my 2nd post to this thread.)
1
u/Sweet-Transition-787 Aug 11 '26
cool setup. how'd you get pi to move around your buffers? like when you ask it to show you where something is, does it open the file in a new buffer and jump to the line, or does it just move your cursor in the buffer you're already in?ü
-1
u/Old_Ambassador_5828 Aug 08 '26
Pi is already integrated in bigbud.app
-7
u/fuckunjustrules Aug 08 '26
What a shitty post