A Neovim plugin for streamlining code reviews directly in your editor.
This project is inspired by ReviewIt - a fantastic code review tool. We created this Neovim-specific implementation with deep respect for the original work.
- π Review Diffs: Start review sessions between branches, commits, or uncommitted changes
- π¬ Add Comments: Comment on single lines or ranges with context
- β Track Progress: Mark files as reviewed and monitor review status
- π Export Reviews: Submit reviews in Markdown or JSON format
- π¨ Flexible UI: Choose between builtin UI or Telescope integration
- Neovim >= 0.7.0
- Git
- At least one of the following diff tools:
- diffview.nvim (optional)
- alt-diffview (optional)
- telescope.nvim (optional, for enhanced UI)
Using lazy.nvim
{
"KEY60228/reviewthem.nvim",
dependencies = {
"sindrets/diffview.nvim", -- optional (need at least one diff tool)
"KEY60228/alt-diffview", -- alternative diff tool
"nvim-telescope/telescope.nvim", -- optional
},
config = function()
require("reviewthem").setup({
-- your configuration here
})
end,
}Using packer.nvim
use {
"KEY60228/reviewthem.nvim",
requires = {
"sindrets/diffview.nvim", -- optional (need at least one diff tool)
"KEY60228/alt-diffview", -- alternative diff tool
"nvim-telescope/telescope.nvim", -- optional
},
config = function()
require("reviewthem").setup({
-- your configuration here
})
end,
}require("reviewthem").setup({
diff_tool = "diffview", -- "diffview" or "alt-diffview"
comment_sign = "π¬", -- Sign shown in gutter for comments
submit_format = "markdown", -- "markdown" or "json"
submit_destination = "clipboard", -- "clipboard" or file path
ui = "builtin", -- "builtin" or "telescope"
keymaps = {
start_review = "<leader>rstart",
add_comment = "<leader>rtc",
submit_review = "<leader>rtsubmit",
abort_review = "<leader>rtabort",
show_comments = "<leader>rtsc",
toggle_reviewed = "<leader>rtmr",
show_status = "<leader>rtrs",
},
command_aliases = {
review_start = "rts", -- :rts expands to :ReviewThemStart
},
})When comparing a specific ref with the working tree (e.g., :ReviewThemStart main), we recommend using alt-diffview as your diff tool:
diff_tool = "alt-diffview",This is because diffview.nvim may not properly display untracked files when comparing with the working tree. alt-diffview handles this scenario more reliably.
-
Start a review session
:ReviewThemStart main feature-branchOr review uncommitted changes:
:ReviewThemStart
-
Navigate and add comments
- Use diffview to navigate through changes
- Press
<leader>rtcto add a comment on the current line - Select multiple lines in visual mode and press
<leader>rtcfor range comments
-
Track your progress
- Press
<leader>rtmrto mark the current file as reviewed - Press
<leader>rtrsto see overall review status
- Press
-
Submit your review
:ReviewThemSubmit
| Command | Description |
|---|---|
:ReviewThemStart [base] [compare] |
Start a review session |
:ReviewThemAddComment |
Add comment to current line/selection |
:ReviewThemSubmit |
Submit all review comments |
:ReviewThemAbort |
Abort current review session |
:ReviewThemShowComments |
Show all comments |
:ReviewThemMarkAsReviewed |
Mark current file as reviewed |
:ReviewThemUnmarkAsReviewed |
Unmark current file as reviewed |
:ReviewThemToggleReviewed |
Toggle reviewed status |
:ReviewThemStatus |
Show review status of all files |
Default mappings (customizable in setup):
| Mapping | Mode | Description |
|---|---|---|
<leader>rstart |
n | Start review |
<leader>rtc |
n, v | Add comment |
<leader>rtsubmit |
n | Submit review |
<leader>rtabort |
n | Abort review |
<leader>rtsc |
n | Show comments |
<leader>rtmr |
n | Toggle reviewed |
<leader>rtrs |
n | Show status |
In the review status window:
t- Toggle reviewed status (builtin UI)<C-t>- Toggle reviewed status (telescope UI)qor<Esc>- Close window
Run :checkhealth reviewthem to diagnose any issues with your setup.
# Code Review
**Base:** main
**Compare:** feature/new-feature
**Date:** 2024-01-15 10:30:00
## Comments
### src/main.lua
- **Line 42:** Consider extracting this logic into a separate function
- **Lines 55-60:** This could be simplified using a table lookup
### tests/main_spec.lua
- **Line 23:** Add test case for edge condition{
"review": {
"base_ref": "main",
"compare_ref": "feature/new-feature",
"timestamp": "2024-01-15 10:30:00",
"comments": [
{
"file": "src/main.lua",
"line_start": 42,
"line_end": 42,
"comment": "Consider extracting this logic into a separate function"
}
]
}
}MIT License - see LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request.
-
AddComment UX Improvements
- Float window input for better writing experience
-
Mark as Reviewed UX Improvements
- Display reviewed marks in file pane
-
ShowComments/ShowStatus UX Improvements
- Press Enter to jump to diff view from comment/status list
-
Extended Diff Tool Support
- Built-in diff mode support
- Other popular diff tools
-
Extended UI Support
- FZF integration
- Other popular UI frameworks
- ReviewIt - The original ReviewIt tool that inspired this Neovim plugin. Thank you for the wonderful idea and implementation!
- diffview.nvim for the excellent diff viewing functionality
- telescope.nvim for the fuzzy finder integration
- Oh My Logo - The amazing tool used to create our logo. Thank you for making logo creation so simple and fun!
