> 2. Extract all deleted lines from FILE 1 into a buffer or another
> file. That is: lines bv345, jd811, jk11.
>
> Is this possible using vimdiff - I assumed that this a variant of
> generating a patch, but couldnt proceed beyond that.
If they're flagged as different, I occasionally use this stunt:
:let @a=''|g/^/if diff_hlID(line('.'), 1) | sil! y A | endif
This yanks all the changed/added into the "a" register (which
means you'd have to run it in FILE2 instead of FILE1 to get the
ones that were added, because you can't yank content where it
doesn't exist :)
You're still left with the problem of getting the diff to be
linewise.
Alternatively, if the data isn't too crazy (no regexp metachars
in it) I've used
:%...@.*@:g/^&$/sil! >
to turn one buffer into a bunch of Ex commands (in this case,
shifting lines that match; but you could use "d" instead of ">"
if you want to nuke the matching lines), and then yank the entire
buffer:
:%y
then executing
@"
in the other window to replay that buffer as a macro. It's a
little down-and-dirty but it gets the job done when I need to
compare two files.
Hope this gives you some ideas...
-tim
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---