gitvimneovimgit-difftool

How to prevent `git difftool` from calling another `vimdiff`?


I have git configured (like below) to use vimdiff as difftool and compare another pair of files without prompting as soon as I call :qa. It's awesome. The only problem is sometimes there are differences in many files. How do I prevent git from running another vimdiff instance and continuing the diffs queue?

git config --global diff.tool vimdiff
git config --global difftool.prompt false
git config --global alias.d difftool

I tried to quit vim with a non-zero error code (:cq) but it doesn't help.

Would be awesome if the answer worked for both vim and nvim.


Solution

  • I got the solution on different stack:

    git config --global difftool.trustExitCode true
    git config --global mergetool.trustExitCode true
    

    And then exiting with :cq

    As mentioned by @VonC, works for nvim as well.