Reputation: 695
CVS diff has the option to display revisions side by side and denote diffs with usual patch symbols like:
import zlib import zlib
> import time
import traceback import traceback
import cElementTree as ElementTree import cElementTree as ElementTree
from util import infopage from util import infopage
> from util.timeout import Timeout
Is there anyway to pipe that output to vimdiff so that it displays those two columns in two side-by-side buffers along with all the diff-highlighting goodness of vimdiff?
I'm aware of tools like cvsvimdiff.vim and the like, but the problem with those is that they only work on one file at a time, whereas the cvs diff output lists multiple files.
Upvotes: 1
Views: 2439
Reputation: 19759
I would write a script say : vimdiff_cvs file.cc which does this:
Upvotes: 0
Reputation: 72926
Once you have that text in a Vim buffer, you can easily split it into two buffers yourself. Looks like your sample input does the split at 50 characters.
So use <C-v>
to visual-block highlight half of the diff, cut it, paste it in a new buffer, remove trailing whitespace and the >
separator characters, and there you go. Or write a function to do it, something like this (which assumes the split is always at 50):
function! SplitCVSDiff()
exe "norm gg_\<C-v>51\<Bar>Gd:vnew\<CR>p"
silent! %s/\v\s+(\> )?$//
endfunction
Might have to be made more robust, I'm not familiar with the exact style of output CVS uses. Shouldn't be hard though.
Upvotes: 1