Home > Blockchain >  List pairs of files when using vimdiff as git difftool
List pairs of files when using vimdiff as git difftool

Time:06-07

I'm using vimdiff as tool when comparing with git difftool.

I want to compare 2 commits with git difftool <commit1> <commit2>. Today, I have to exit every vimdiff view with :qa to get to the next file pair. Sometimes, the list of file pairs can be huge with this type of comparison. Then, I have to type :qa dozens of times (or :cq when done).

Is there a way to display all compared file pairs (with at least 1 change) in a QuickFix, Location List or something similar?

Then, it would be must easier to get an overview and to scroll through all changes and show only the diff of selected files.


Extract of my .gitconfig:

[diff]
    tool = vimdiff
[difftool]
    prompt = false
    # Be able to abort all diffs with `:cq` or `:cquit`
    trustExitCode = true

vimdiff --version:

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 18 2022 19:26:30)
Included patches: 1-3995

git --version:

git version 2.34.1

CodePudding user response:

The vimdiff in tool = vimdiff is not actually vimdiff. It's vimdiff

IMO, it's a pain in the ass compared to the UX provided in GUI difftools:

filemerge

But, since you mentioned the quickfix, you might like git-jump

Which is pretty good for navigating from one change to another but doesn't really help solving the problem of seeing the actual diff.

Maybe a third-party plugin like this one could help but you would have to come up with a proper Git integration.

That sounds like a cool week-end project.

  • Related