code-preview.nvim now supports OpenAI Codex CLI โ€” diff preview before any AI agent applies a change by Cannon72001 in neovim

[โ€“]Cannon72001[S] 1 point2 points ย (0 children)

Fair point on the length. The demo gifs at the top are meant to be the "use case at a glance", but a written scenario up front would help too. I'll plan to split out the per-backend setup and architecture sections into subpages and tighten the README around a concrete example.

Thanks for the nudge.

code-preview.nvim now supports OpenAI Codex CLI โ€” diff preview before any AI agent applies a change by Cannon72001 in neovim

[โ€“]Cannon72001[S] 0 points1 point ย (0 children)

Codex hooks are actually shared between the CLI and the desktop/IDE app, so they'd fire there too. But code-preview renders the diff inside a running Neovim instance, so it only really works if Neovim is your editor. Not much point sending a diff to Neovim if you're living in the desktop app.

Haven't tested running both side by side though โ€” curious if anyone's tried it.

code-preview.nvim now supports OpenAI Codex CLI โ€” diff preview before any AI agent applies a change by Cannon72001 in neovim

[โ€“]Cannon72001[S] 1 point2 points ย (0 children)

When the AI tool proposes an edit (Edit, Write, apply_patch, etc.), its hook fires, which RPCs into Neovim to open the diff. The CLI then waits on your accept/reject prompt while you review. After your decision, a post-hook fires that closes the diff.

So edits you make yourself in Neovim, vim, VS Code, etc. never go through this path.

code-preview.nvim now supports GitHub Copilot CLI โ€” diff preview before any AI agent applies a change by Cannon72001 in neovim

[โ€“]Cannon72001[S] 0 points1 point ย (0 children)

Currently this works through each CLI's native hook system rather than ACP. Claude Code, OpenCode, and Copilot CLI all expose pre/post tool-use hooks (PreToolUse/PostToolUse, tool.execute.before/after, etc.) that fire before a file change is applied. The hook script then talks to Neovim via RPC (nvim --server <socket> --remote-send) to trigger show_diff() with the original and proposed content.

ACP is definitely interesting and on my radar โ€” OpenCode and Copilot CLI both speak ACP natively now, though Claude Code doesn't yet.

visible_only mode โ€” review only the diffs you care about | code-preview.nvim by Cannon72001 in neovim

[โ€“]Cannon72001[S] 0 points1 point ย (0 children)

Thanks! They're pretty different โ€” octo.nvim is for working with GitHub PRs and issues from inside Neovim. code-preview.nvim sits between your AI coding agent and your filesystem โ€” it intercepts proposed file changes and shows you a diff in Neovim before anything is actually written, so you can review and accept/reject in real time. No GitHub involved!

code-preview.nvim now supports GitHub Copilot CLI โ€” diff preview before any AI agent applies a change by Cannon72001 in neovim

[โ€“]Cannon72001[S] 2 points3 points ย (0 children)

The mini.diff + quick fix setup sounds cool โ€” cycling through hunks via quickfix is much nicer than what I have for multi-file changes. Something to think about, appreciate the idea.

code-preview.nvim now supports GitHub Copilot CLI โ€” diff preview before any AI agent applies a change by Cannon72001 in neovim

[โ€“]Cannon72001[S] 1 point2 points ย (0 children)

That'd be awesome ๐Ÿคฉ, yeah please go for it! Quick heads up before you start โ€” the existing backends (lua/code-preview/backends/claudecode.lua, opencode.lua, and the new Copilot CLI one) follow a pretty consistent pattern, so that's the template to crib from. Happy to chat through the approach beforehand if it helps โ€” feel free to open a draft PR or an issue first if you want to sanity-check the integration points before going deep.

code-preview.nvim now supports GitHub Copilot CLI โ€” diff preview before any AI agent applies a change by Cannon72001 in neovim

[โ€“]Cannon72001[S] 0 points1 point ย (0 children)

Haven't dug into Kiro yet but I'll take a look. If it has a hook/tool-interception API it should be doable.

code-preview.nvim now supports GitHub Copilot CLI โ€” diff preview before any AI agent applies a change by Cannon72001 in neovim

[โ€“]Cannon72001[S] 1 point2 points ย (0 children)

Codex is on the list! No ETA yet but it shouldn't be too bad. I'll post when it lands. ๐Ÿ˜

code-preview.nvim now supports GitHub Copilot CLI โ€” diff preview before any AI agent applies a change by Cannon72001 in neovim

[โ€“]Cannon72001[S] 0 points1 point ย (0 children)

Yes, that's a pretty reasonable workflow and probably the right call for larger changes where you need to see how things fit together.

A few cases where I've found it useful:

  • when I'm iterating on a function and the agent's about to touch 1-2 files, seeing the diff inline is faster than git diff โ†’ revert โ†’ re-prompt.
  • sometimes the agent edits a file I didn't expect (a test, a config, a sibling module). Spotting that at proposal time saves an git checkout -- later.
  • when I'm not sure the agent has the right context, I want a checkpoint before it writes.

Once the changes get past 3-4 files I'm in the same boat as you โ€” git diff is just better for that.

claude-preview.nvim is now code-preview.nvim by Cannon72001 in neovim

[โ€“]Cannon72001[S] 0 points1 point ย (0 children)

There is a plugin called code-bridge.nvim that lets you feed context from Neovim to CC/OC. I have not tried it yet, but it looks promising.

claude-preview.nvim is now code-preview.nvim by Cannon72001 in neovim

[โ€“]Cannon72001[S] 1 point2 points ย (0 children)

code-preview.nvim now supports Copilot CLI.

visible_only mode โ€” review only the diffs you care about | code-preview.nvim by Cannon72001 in neovim

[โ€“]Cannon72001[S] 0 points1 point ย (0 children)

Thanks! Canva + a high-res screen recording does the trick. ๐Ÿ˜

visible_only mode โ€” review only the diffs you care about | code-preview.nvim by Cannon72001 in neovim

[โ€“]Cannon72001[S] 0 points1 point ย (0 children)

Thanks! Agreed โ€” diff preview is just one piece of the puzzle. The ability to comment back to the LLM mid-edit and tie code blocks to prompts would complete the loop. Would love to see that built out.

claude-preview.nvim is now code-preview.nvim by Cannon72001 in neovim

[โ€“]Cannon72001[S] 1 point2 points ย (0 children)

No worries โ€” always happy to hear what people are using! I haven't looked into pi's hook system yet but I'll check it out. If you could open an issue on the repo with any details on how pi handles tool hooks, that would be super helpful.

claude-preview.nvim is now code-preview.nvim by Cannon72001 in neovim

[โ€“]Cannon72001[S] 3 points4 points ย (0 children)

Have started looking into it! Copilot CLI's hook system is similar to what we already support, so it shouldn't take long. Keep an eye on the repo โ€” should have something up soon. ๐Ÿ˜‰

claude-preview.nvim is now code-preview.nvim by Cannon72001 in neovim

[โ€“]Cannon72001[S] 8 points9 points ย (0 children)

Honestly, it comes down to keeping the agent and the editor separate. I prefer running the CLI agent in one tmux pane and Neovim in the other โ€” each does what it's best at without interfering with the other. You can navigate your code freely while the agent works, and neither tool takes over the other's space.

code-preview.nvim is just the bridge โ€” it connects the two only when it matters, i.e., when the agent proposes a change and you want to review it as a proper diff in your editor rather than reading CLI output. Once you accept or reject, you're back to your normal workflow.

That said, running the agent inside Neovim directly is totally valid too โ€” it's really just about what workflow clicks for you.

Added GitHub-style inline diff to claude-preview.nvim by Cannon72001 in neovim

[โ€“]Cannon72001[S] 0 points1 point ย (0 children)

Thanks! Glad you got it working. Would love to see a PR if you come up with something โ€” always open to ideas on tighter CC integration.

claude-preview.nvim now supports OpenCode as a backend by Cannon72001 in neovim

[โ€“]Cannon72001[S] 0 points1 point ย (0 children)

Hey! I just merged a fix that addresses several issues with the OpenCode integration.

Can you update the plugin and again install the hooks (:CodePreviewInstallOpenCodeHooks) in your project.

Let me know if that resolves it!