> ...I'm trying to use Vim script identify areas in unified diffs showing
> changes in lines (as opposed to additions or deletions) and use a more
> striking highlighting mode to point out, say, when a single letter or
> space changes in a line.
>
> ...
>
> To see how other tools highlight stuff, I've been doing stuff like:
> - vimdiff old new
> - git diff old new
> - git diff --color-words old new
> - emacs tmp.diff (then ALT-n once emacs starts up)
>
> ...
>
> for some reason I'm also really getting stuck
> breaking down/identifying/solving the problem about how to identify
> which parts of a line have changed. Tokenizing/scanning/whatever you
> call it is partly subjective--see the new "git --word-diff-regex"
> command line argument, and discussion around same on the git mailing
> list. In fact, the git solution might be the most elegant and flexible
> algorithm to emulate.
>
I haven't really been following this thread in detail, and I'm no
expert on all-things-diffing, but I thought that Neil Fraser's
diff_match_patch (which I have no affilation with; available here:
http://code.google.com/p/google-diff-match-patch/) might be of
interest. It handles intra-line changes nicely, and the souce code is
available to look at. According to its page:
"This library implements Myer's diff algorithm (http://
neil.fraser.name/software/diff_match_patch/myers.pdf) which is
generally considered to be the best general-purpose diff. A layer of
pre-diff speedups and post-diff cleanups surround the diff algorithm,
improving both performance and output quality.
This library also implements a Bitap matching algorithm (http://
neil.fraser.name/software/diff_match_patch/bitap.ps) at the heart
of a flexible matching and patching strategy (http://neil.fraser.name/
writing/patch/)."
Regards,
James.
--
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