A Neovim plugin for reviewing git diffs file by file using vim-fugitive's diff view.
- Review changes against any branch with a side-by-side diff view
- Navigate between changed files with configurable keymaps
- Automatic file list from
git diff --name-only - Completion for common branch names (origin/main, main, master, HEAD~1)
- Neovim >= 0.9.0
- vim-fugitive
{
"LuccaRomanelli/git-review.nvim",
dependencies = { "tpope/vim-fugitive" },
config = function()
require("git-review").setup()
end,
}use {
"LuccaRomanelli/git-review.nvim",
requires = { "tpope/vim-fugitive" },
config = function()
require("git-review").setup()
end,
}Plug 'tpope/vim-fugitive'
Plug 'LuccaRomanelli/git-review.nvim'
" In your init.lua or after/plugin:
lua require("git-review").setup()require("git-review").setup({
-- Default branch to diff against
default_branch = "origin/main",
-- Keymaps for navigation
keymaps = {
next = "]g", -- Go to next changed file
prev = "[g", -- Go to previous changed file
},
-- Set to false to define your own keymaps
keymaps_enabled = true,
})If you prefer to set up your own keymaps:
require("git-review").setup({
keymaps_enabled = false,
})
local git_review = require("git-review")
vim.keymap.set("n", "<leader>gn", git_review.next, { desc = "Next file in git review" })
vim.keymap.set("n", "<leader>gp", git_review.prev, { desc = "Previous file in git review" })| Command | Description |
|---|---|
:GitReview [branch] |
Start reviewing changes against a branch (default: origin/main) |
:GitReviewStop |
Stop the current review session |
| Keymap | Description |
|---|---|
]g |
Go to next changed file |
[g |
Go to previous changed file |
-
Start a review session:
:GitReview origin/main
-
Navigate through changed files:
- Press
]gto go to the next file - Press
[gto go to the previous file
- Press
-
When you reach the last file and press
]g, you'll be prompted to quit or go back.
Initialize the plugin with optional configuration.
Start a review session against the specified branch.
Navigate to the next changed file.
Navigate to the previous changed file.
Stop the current review session.
Returns true if a review session is currently active.
Returns the current review status:
{
current = 2, -- Current file index
total = 5, -- Total number of changed files
file = "foo.lua", -- Current file name
branch = "main", -- Branch being diffed against
}MIT