You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-9Lines changed: 42 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,20 @@
2
2
3
3
A Neovim plugin that shows a **diff preview before your AI coding agent applies any file change** — letting you review exactly what's changing before accepting.
4
4
5
-
Supports [Claude Code](https://docs.anthropic.com/en/docs/claude-code) and [OpenCode](https://opencode.ai) as backends.
5
+
Supports [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [OpenCode](https://opencode.ai), and [GitHub Copilot CLI](https://github.com/github/copilot-cli) as backends.
7. Accept/reject in OpenCode; the diff closes automatically on accept
111
119
8. If rejected, press `<leader>dq` to close the diff manually
112
120
121
+
### GitHub Copilot CLI
122
+
123
+
1. Install the plugin and call `setup()`
124
+
2. Open a project in Neovim
125
+
3. Run `:CodePreviewInstallCopilotCliHooks` — writes `.github/hooks/code-preview.json`
126
+
4. Start Copilot CLI in the project directory
127
+
5. Ask Copilot to edit a file — a diff opens automatically in Neovim
128
+
6. Accept/reject in the CLI; the diff closes automatically on accept
129
+
7. If rejected, press `<leader>dq` to close the diff manually
130
+
131
+
> **Note:** Copilot CLI does not fire post-tool hooks on rejection, so rejected diffs remain open until you dismiss them (same as Claude Code).
132
+
113
133
---
114
134
115
135
## How it works
@@ -132,7 +152,9 @@ AI Agent (terminal) Neovim
132
152
133
153
**OpenCode** uses a TypeScript plugin (`tool.execute.before`/`tool.execute.after`) loaded from `.opencode/plugins/`.
134
154
135
-
Both backends communicate with Neovim via RPC (`nvim --server <socket> --remote-send`).
155
+
**GitHub Copilot CLI** uses shell-based hooks (`preToolUse`/`postToolUse`) configured in `.github/hooks/code-preview.json`. The adapter translates Copilot's tool vocabulary (`apply_patch`, `edit`, `create`, `bash`) into the same normalized format used by the other backends.
156
+
157
+
All backends communicate with Neovim via RPC (`nvim --server <socket> --remote-send`).
If you use [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim), code-preview will automatically decorate your file tree with visual indicators when changes are proposed. No extra configuration is required — it works out of the box.
0 commit comments