A Neovim plugin for collecting structured, file/line-referenced review comments and copying them as context into a coding agent (e.g. an LLM chat).
Note
This code was written entirely by an AI coding agent. I have not read it. Use at your own risk.
{
'jfahrer/code-review.nvim',
opts = {},
cmd = { 'ReviewStart', 'ReviewAdd', 'ReviewOpen', 'ReviewCopy', 'ReviewClose',
'ReviewFinish', 'ReviewNext', 'ReviewPrev' },
keys = {
{ '<leader>rs', '<cmd>ReviewStart<cr>', desc = 'Review: Start' },
{ '<leader>ra', function() require('code-review').add() end, desc = 'Review: Add', mode = { 'n', 'v' } },
{ '<leader>ro', '<cmd>ReviewOpen<cr>', desc = 'Review: Open' },
{ '<leader>rv', '<cmd>ReviewOpen v<cr>', desc = 'Review: Open (vertical)' },
{ '<leader>rh', '<cmd>ReviewOpen h<cr>', desc = 'Review: Open (horizontal)' },
{ '<leader>ry', '<cmd>ReviewCopy<cr>', desc = 'Review: Copy' },
{ '<leader>rq', '<cmd>ReviewClose<cr>', desc = 'Review: Close window' },
{ '<leader>rf', '<cmd>ReviewFinish<cr>', desc = 'Review: Finish' },
{ '<leader>rn', '<cmd>ReviewNext<cr>', desc = 'Review: Next' },
{ '<leader>rp', '<cmd>ReviewPrev<cr>', desc = 'Review: Previous' },
},
}require('code-review').setup(opts) registers commands, keymaps and autocmds.
| Command | Description |
|---|---|
:ReviewStart |
Start or reset a review session. |
:ReviewAdd |
Add a comment at the cursor (normal) or visual selection. |
:ReviewOpen [v|h] |
Open the review buffer in a split. |
:ReviewCopy |
Yank the rendered review into the clipboard (no window needed). |
:ReviewClose |
Close the review window (keeps the session). |
:ReviewFinish |
Copy the review to the clipboard, then end the session, clear signs, close the buffer. |
:ReviewNext / :ReviewPrev |
Jump between reviewed positions. |
:ReviewStart(or just:ReviewAdd, which auto-starts a session).- Put the cursor on a line — or visually select a range — and
:ReviewAdd. A floating window opens for the comment.<C-s>/<CR>confirms,<Esc>/<C-c>cancels. :ReviewOpenrenders all entries withfile:linereferences. Inside that buffer:<CR>jumps to the position,eedits a comment,ddeletes one.:ReviewCopyputs the whole review on the clipboard for pasting into a chat.:ReviewFinishcopies the review to the clipboard, then ends the session and clears the gutter signs.
Reviews are in-memory by default. Enable persistence to keep a review across Neovim restarts:
opts = {
persist = {
enabled = true,
file = '.code-review', -- path relative to the cwd
},
}When enabled:
- Adding, editing, or removing a comment auto-saves the file (JSON).
- The first time you start reviewing in a session — and no review has happened yet — if a persisted file exists you're asked whether to restore it. Decline and the stale file is deleted so you start clean.
:ReviewFinishdeletes the persisted file (the review is done and has just been copied to your clipboard). A restart mid-review still restores.
Add .code-review to your .gitignore (or commit it to share reviews).
See design.md for the full design and configuration defaults.
make test