Wednesday, April 7, 2010

Re: multiple diffs

On Apr 7, 9:28 pm, Tim Chase <v...@tim.thechases.com> wrote:
> viki wrote:
> > I have file containing >20 pairs of pathnames, one pair per line:
>
> >        /path1/to/file1.OLD /path2/to.file1.NEW
> >        etc.
>
> > I need to open vimdiff on multiple pairs of files
> > such that I can switch forward to next pair, backward to
> > previous pair, each time seeing vimdiff of that pair.
> > How can I do it ? Is there a plugin that does such thing ?
>
> Within your pathname file, you should be able to enter this (in
> case it line-breaks between here and there, it should all be on
> one line)
>
> :nnoremap <buffer> <f4> :sil! only <bar> let
> [a,b]=split(getline('.'))[:1] <bar> exec "sp ".a <bar> exec
> "below vert diffsplit ".b<cr>
>
> It chokes if you only have one filename on the line, and tromps
> variables named "a" and "b" in the local context, but should
> allow you to easily hit <f4> on any line in your file and get a
> diff of the two files.
>
> Note that because Vim only allows diffing up to 4 files (and I
> believe they all have the same differences tested, so in your
> case, 2 is a more practical limit) it closes all other windows
> (intentionally the diffing windows, but will also close other
> windows you have open) with :only so that the next opening gives
> you a fresh diff.  The limit is documented at ":help E96".
>
> -tim

Thanks. Trying to make it into prev/next mappings ...

viki

--
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: