revdiff icon indicating copy to clipboard operation
revdiff copied to clipboard

Open the focused file's old/new versions in an external diff tool (e.g. vimdiff)

Open soheilghafurian opened this issue 3 weeks ago • 2 comments

Problem

vimdiff is my standard diff tool. When reviewing in revdiff I can't open the file I'm looking at in it. I have to quit or leave revdiff and re-run vimdiff by hand with the right revisions, which is tedious.

What exists today

  • e opens the working-tree file in $EDITOR. It isn't a diff, so there is no old side. It also refuses files with line annotations and doesn't work with --stdin.
  • --keys only rebinds built-in actions, and --post-flush-command isn't file-aware, so neither can do this.
  • I found no existing issue or PR for difftool, vimdiff or external diff.

Proposal

A new action, open_in_difftool (default E), that suspends the TUI, opens the focused file's old and new versions in an external diff tool (default vimdiff, configurable), then reloads. Git only. This is not in-TUI side-by-side (#426): revdiff's rendering and annotation logic are untouched.

I have a working implementation of about 600 lines including tests, and I'm happy to trim it or drop the idea. I won't open a PR unless you approve.

Developed with AI assistance (Claude Code).

soheilghafurian avatar Nov 10 '26 19:11 soheilghafurian

I'd rather not add this one. Showing the diff and collecting annotations for the caller is what revdiff does, and handing the file over to another diff viewer is outside that. It would also bring a new key, a tool setting and per-mode rules (refs, --staged, untracked, stdin, hg and jj) to maintain, for something git difftool already does.

if you want vimdiff on a file while revdiff is open, run it from another pane with the same refs as the review:

git difftool -y HEAD~3 -- path/to/file.go          # revdiff HEAD~3
git difftool -y --cached -- path/to/file.go        # revdiff --staged

with diff.tool = vimdiff in your git config, that opens the same pair revdiff shows.

thx for asking before sending the PR.

umputun avatar Nov 11 '26 17:11 umputun

Thanks for the prompt reply! Sounds like the scope is kept specific. I forked a personal branch for this capability. Will not send a PR.

Best

soheilghafurian avatar Nov 23 '26 16:11 soheilghafurian