Message from discussion
How to "destructive vimdiff" ;) two files ?
Date: Tue, 9 Oct 2012 08:53:07 -0700 (PDT)
From: Ben Fritz <fritzophre...@gmail.com>
To: vim_use@googlegroups.com
Cc: cbli...@256bit.org
Message-Id: <3b31bdf9-c105-4277-9a9f-1cdccf1640a7@googlegroups.com>
In-Reply-To: <90b6a9ef6f66aaf75f4778cec609bc1c.squirrel@comm.256bit.org>
References: <20121007025022.GB3447@solfire>
<90b6a9ef6f66aaf75f4778cec609bc1c.squirrel@comm.256bit.org>
Subject: Re: How to "destructive vimdiff" ;) two files ?
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_220_20686815.1349797987703"
------=_Part_220_20686815.1349797987703
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
On Tuesday, October 9, 2012 8:10:29 AM UTC-5, Christian Brabandt wrote:
>
> You need to loop over each line and get the diff_hlID() for that position.
>
> Each line, where diff_hlID() returns zero you need to delete.
>
>
>
> Of course, you can do it in one step ;)
>
>
>
> exe ':g/'. join(map(filter(range(1,line('$')), '!diff_hlID(v:val, 0)'), '
>
> ''\%''.v:val."l"'), '\|'). '/d'
>
>
>
> But, this works only once, you can't do this for all buffers at the
>
> same time, since after you changed the first buffer the syntax highlighting
>
> for the other will be completely different and there will be no more
>
> items being in common at the following buffers.
>
But, you could next undo the (single) change in the first buffer, repeat the process on the second buffer, then redo the change in the first buffer.
------=_Part_220_20686815.1349797987703--