feat(commands): add :Greview for unified diff review with qflist/loclist #202

Merged
barrettruth merged 8 commits from feat/greview into main 2026-03-23 21:48:51 +00:00
barrettruth commented 2026-03-23 19:53:35 +00:00

Problem

diffs.nvim provides :Gdiff for single-file diffs and gdiff_section() for staged/unstaged sections, but has no way to view a full unified diff against an arbitrary git ref (e.g. origin/main) with structured file and hunk navigation.

Solution

Add M.greview(base, opts) to commands.lua, which creates a unified diff buffer named diffs://review:{base}, parses diff --git and @@ positions, and populates the qflist (files with +N/-M stats) and loclist (hunks with filename, hunk number, and @@ header). All list entries point into the diff buffer so cnext/lnext navigate naturally within it.

Also adds:

  • M.review_file_at_line(bufnr, lnum) utility for finding the filename at any line in a review buffer
  • read_buffer() review label case for :e refresh
  • :Greview command with git ref tab completion
  • Vimdoc section
  • 6 new tests
## Problem diffs.nvim provides `:Gdiff` for single-file diffs and `gdiff_section()` for staged/unstaged sections, but has no way to view a full unified diff against an arbitrary git ref (e.g. `origin/main`) with structured file and hunk navigation. ## Solution Add `M.greview(base, opts)` to `commands.lua`, which creates a unified diff buffer named `diffs://review:{base}`, parses `diff --git` and `@@` positions, and populates the qflist (files with `+N`/`-M` stats) and loclist (hunks with filename, hunk number, and `@@` header). All list entries point into the diff buffer so `cnext`/`lnext` navigate naturally within it. Also adds: - `M.review_file_at_line(bufnr, lnum)` utility for finding the filename at any line in a review buffer - `read_buffer()` `review` label case for `:e` refresh - `:Greview` command with git ref tab completion - Vimdoc section - 6 new tests
Sign in to join this conversation.
No description provided.