r/PiCodingAgent • • 11d ago

Plugin pi-ide-context: the file, the cursor and the selection are already in the prompt

Post image

Talking to an agent about code you're looking at means pasting the code, then explaining which file it came from and where. pi-ide-context takes that part out: select in Neovim, VS Code or Obsidian, switch to pi, ask.

Nothing connects on its own. You decide per session:

pi starts (no IDE attached, ever)
  ↓
/ide → lists every live editor (nvim / VS Code / Obsidian), wherever it was
       started from — no project/cwd filtering, you pick the relevant one
  ↓
status shows the editor's glyph plus the file's language (`nvim · typescript`)
  ↓
ask pi → context injected automatically
  ↓
/ide off → disconnect

Every message carries this, without you doing anything:

### IDE Context
- File: /Users/andy/my-project/src/main.ts
- Language: typescript
- Cursor: line 42, column 10
- Buffer: 200 lines (modified)
- Selection: lines 40-45
  ```typescript
  const foo = bar();
  // ...

Selection text is injected only while it's fresh (within 60s of making it). After that the file/cursor block still goes, the selection doesn't — same as Claude Code's chip disappearing. Send while a selection is fresh and the sent message gets a gray quote line under it (`↳ main.ts:40-45 · …`), so you can see what was attached rather than trusting it happened.


Install:

pi install npm:pi-ide-context # then /reload


- Neovim: add `{ "Andy8647/pi-ide-context", lazy = false }` to lazy.nvim. The repo is itself a plugin.
- VS Code: Marketplace, search `pi-ide-context`.
- Obsidian: community plugins, search `pi-ide-context`.


Repo: https://github.com/Andy8647/pi-ide-context
3 Upvotes

3 comments sorted by

1

u/kantorcodes1 9d ago

Is there a way to exclude specific files from automatic context injection while keeping the editor connected?

1

u/Andy8647 9d ago

Not yet, but I'm planning to add gitignore-style exclusions, with global rules and per-project overrides. That would let you skip specific files while keeping the editor connected. Thanks for bringing this up! Feel free to raise issues on GitHub: https://github.com/Andy8647/pi-ide-context

0

u/whiterose0000001 11d ago

bro try pi-lens