Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vdiff.nvim

Capture PR-review comments as local JSON while you read code — in your everyday nvim, or inside vdiff's embedded nvim pane.

Usage

  1. Select a range in visual mode, run :VdiffComment (or <leader>vc).
  2. Write the comment in the floating window; <CR> or :w to save, q/<Esc> to cancel.

Browse everything captured in the current repo with :VdiffComments (opens the quickfix list).

Keys

Key / command Mode Effect
:[range]VdiffComment any Compose a comment for range (current line if omitted)
<leader>vc visual Default mapping for :VdiffComment (skip via vim.g.vdiff_no_default_mappings = 1)
<Plug>(vdiff-comment) visual Remappable operator, if you don't want <leader>vc
:VdiffComments any Load all comments for the repo into the quickfix list
<CR> / :w compose float, normal Submit
q / <Esc> compose float, normal Cancel

comments.json

Stored at <git-dir>/vdiff/comments.json, where <git-dir> is git rev-parse --absolute-git-dir for the file's directory — deliberately not <repo-root>/.git joined by hand, so linked worktrees (git worktree add) each get their own independent comment store. Pretty-printed, 2-space indent, sorted by (path, start_line):

[
  {
    "id": "c1",
    "path": "src/lib.rs",
    "start_line": 12,
    "end_line": 14,
    "text": "Consider extracting this.\nSecond line ok.",
    "node": "rust:crate",
    "created_at": "2026-08-18T10:05:30Z"
  }
]

path is repo-relative (forward slashes). start_line/end_line are 1-based inclusive, against the current worktree version of the file. node is present only for comments carrying a graph-node id (omitted entirely otherwise — never null). created_at is ISO-8601 UTC.

vdiff integration

Inside vdiff's embedded nvim pane it just works with zero configuration — the embedded session runs your normal nvim config, so this plugin loads there automatically; vdiff's graph pane calls require('vdiff').comment_range(...) (its c key on a focused node) to open the same compose flow with a node id attached.

Install

lazy.nvim

{
  "jowi-dev/vdiff.nvim",
  -- config = function() require("vdiff").setup({}) end, -- optional
}

Nix (buildVimPlugin)

vdiff-nvim = pkgs.vimUtils.buildVimPlugin {
  pname = "vdiff.nvim";
  version = "unstable";
  src = pkgs.fetchFromGitHub {
    owner = "jowi-dev";
    repo = "vdiff.nvim";
    rev = "main";
    hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
  };
};

Testing

make test        # or ./tests/run.sh

Hand-rolled headless harness (nvim --headless -u tests/minimal_init.lua -l tests/run.lua), no plenary dependency: storage round-trip, id allocation, path relativization, node omission, sort order, and linked-worktree git-dir resolution, all against real temp git repos.

Follow-ups (out of scope for now)

  • Posting captured comments to a GitHub PR review.
  • An edit/delete UI — for now, hand-edit comments.json.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages