James McCoy wrote: > Needing to fallback to :diffget/:diffput instead of do/dp when dealing > with a 3-way diff has always bothered me. I've been having to do that > more lately, so the attached patch turns a supplied [count] for do/dp > into the [bufspec] for :diffget/:diffput. > > Obviously, it's not as expressive as being able to use the full bufspec, > but, at least for me, I always know the buffer number, so providing the > count is much quicker.
Hi James Your patch looks useful. But you wrote "3-way diff" and in my opinion, Vim diff does not do 3-way diff. Vim can diff 3 files against each other, but that does not qualify as a 3-way diff. The following page that compares diff tools here. Vim is listed as not supporting 3-way diff: http://en.wikipedia.org/wiki/Comparison_of_file_comparison_tools For a 3-way diff, I would expect to be able to say what is the common ancestor and what are the 2 files changed from their common ancestors, and I would then expect the diff tool to only highlight differences between the common ancestor and the 2 other files only, but not highlight differences between the 2 other files. Let's use a concrete example and compare vim diff with another tool (meld, "sudo apt-get install meld" on Ubuntu) that does 3-way diff as described: $ cat common-ancestor.txt Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9 Line 10 Line 11 $ cat local.txt Line A Line 2 Line 3 Line B Line 5 Line 6 Line C Line 8 Line 9 Line 10 Line 11 Line 12 $ cat remote.txt Line 1 Line 2 Line 3 Line D Line 5 Line 6 Line C Line 8 Line 9 Line 11 Now compare the output of vim diff with the output of meld tool: $ vim -d local.txt common-ancestor.txt remote.txt See: http://dominique.pelle.free.fr/pic/vim-3-files.png $ meld local.txt common-ancestor.txt remote.txt See: http://dominique.pelle.free.fr/pic/meld-3-files.png Notice that Vim highlights line 1 for the 3 files, whereas meld diff tool only highlights the diff for line 1 between file local.txt and line common-ancestor.txt, because it was not changed in remote.txt from the common ancestor. Unlike Vim, meld knows what is the common ancestor. This is more useful and clearer in my opinion than the way Vim shows the diff. Similarly, unlike Vim, meld does not show that line 12 was deleted in remote.txt. Furthermore, I see that unlike Vim, meld appears to highlight differently changes made in local.txt and remote.txt that conflict i.e. that would prevent automatic merging. That's also useful. In the example, change made on line 4 is the only conflict and is highlighted in red by meld. This also requires knowing what is the common ancestor file. Regards Dominique -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
