Tuesday, June 5, 2012

Re: vim-diff

On Tuesday, June 5, 2012 5:52:47 AM UTC-5, sinbad wrote:
> 21
> 22 when i take the diff, the diff is as shown below.
> 23 actually the differnece is from line 5-6 in the first
> 24 file, its the new if block added, but vim-diff tries to
> 25 compare line 5-6 of first file with line 17, and shows
> 26 the diffrences from there on, now i want tell vimdiff
> 27 to actually try to match line 9 of first file line 17
> 28 of the second file, so that i can get the correct
> 29 differences. actually this feature is available in other
> 30 diff tools like beyondcompare, where one can specify where
> 31 to start comparing the files.
> 32

I cannot understand what you're trying to show with your examples, but I THINK from your description that you're looking for a way to manually align lines in diff mode. As you mention BeyondCompare can do this, as well as KDiff3 and probably some other dedicated visual diff tools.

Vim cannot do this internally, it relies on an external command-line diff tool. It might be possible to find an alternate command-line diff tool which DOES support this and integrate it with Vim using Vim's diffexpr and probably some mappings to set the various alignment points. But, a quick search doesn't turn up much.

Looking at the documentation for GNU Diff, I don't see any option for choosing lines which should align with each other, though I have no idea what some of them (like --line-format) might be for, even after reading the documentation.

Actually, thinking about it some more...I bet someone could use diffexpr to pass PORTIONS of the file to diff rather than entire files, and then concatenate the resulting diffs together. The portions start/end positions would be defined by mappings invoked by the user, probably to place some signs in each buffer. This actually sounds like a fun project to try sometime...

--
You received this message from the "vim_use" 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

No comments:

Post a Comment