Closed Blake-LeBlanc closed 5 years ago
I think I just figured it out!
I set up the .gitconfig file as follows:
[merge]
tool = diffconflicts
[mergetool "diffconflicts"]
cmd = vim -c DiffConflicts \"$MERGED\" \"$BASE\" \"$LOCAL\" \"$REMOTE\"
trustExitCode = true
[mergetool]
keepBackup = false
[diff]
tool = vimdiff
[difftool "vimdiff"]
cmd = vimdiff "$LOCAL" "$REMOTE"
And while vim's bulit-in 'vimdiff' may not be the tool I'm ultimately wanting to use, what results is a view that looks surprisingly similar to that shown by diffconflicts (perhaps it is looking to the configured merge tool, causing it to use diffconflicts?).
Either way, the result is what I was looking for :+1:
Will leave open in case there is a more diffconflicts related approach the dev's would like to chime in with. Otherwise, feel free to close'er down!
Very intriguing use-case. Thanks for the follow-up with your solution! (I'm going to add that to my own .gitconfig too 😀.) I think you landed on the best solution even if the file-by-file invocations are slow-going.
Splitting/parsing a diff/patch file looks to be a little tough. Diffconflicts is a glorified sed
search/replace and doesn't do anything so nuanced. Vim has a :diffpatch
command that gets part of the way there. I wonder if there's a possible approach where we could load all the changed files in a Git comparison into the arglist, checkout the merge base, and then register a BufRead autocommand to run git diff <range> -- <currentfile>
to make a temporary patch file and then :diffpatch
the current file with that. 🤔 But if so, it wouldn't share any code with Diffconflicts and so would be better done as a separate plugin.
Thanks for raising the question!
Is it possible to use diffconflicts's excellent two-pane presentation to view differences between files? Vim's default terminal output of cramming everything into one giant single-column display can prove quite cumbersome when needing to identify and update a file's contents.
I've set up my .gitconfig with:
[difftool "diffconflicts"]
When I launch a diff mode
$ git diff <branch1> <branch2>
I am given the following prompt: "Launch 'diffconflicts' [Y/n]"And then only a single file opens into view.
Thank you again for your great plugin! And if this question is outside of the scope of this plugin, I apologize. Just tell me so and I'll gladly search for a solution elsewhere :)
All the best, Blake