Gurus: Line by line comparison of two files (NOT [vim]diff)

542 views
Skip to first unread message

Philip Rhoades

unread,
Apr 13, 2013, 2:51:26 AM4/13/13
to vim...@googlegroups.com
People,

With two text files open in vertical panels, I would like to be able to
cursor around on the left side file and for the same (or nearly the same
line) to be centred and highlighted on the right side . .

Any gurus who could work out how to do this? - is it even possible in
Vim?

Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: ph...@pricom.com.au

Salman Halim

unread,
Apr 13, 2013, 7:19:46 AM4/13/13
to vim...@googlegroups.com


On Saturday, April 13, 2013, Philip Rhoades wrote:
People,

With two text files open in vertical panels, I would like to be able to cursor around on the left side file and for the same (or nearly the same line) to be centred and highlighted on the right side . .

Any gurus who could work out how to do this? - is it even possible in Vim?

Thanks,

Phil.
--
Philip Rhoades


I might be simplifying it a bit, but how about going to the top of both files and executing:

:windo set  cursorbind scrollbind cursorline

It seems to me that this would keep both files in sync and highlight the current line in both windows. 

Salman


--
سلمان حلیم

Erik Falor

unread,
Apr 13, 2013, 3:26:35 PM4/13/13
to vim...@googlegroups.com
On Sat, Apr 13, 2013 at 07:19:46AM -0400, Salman Halim wrote:
> On Saturday, April 13, 2013, Philip Rhoades wrote:
>
> > People,
> >
> > With two text files open in vertical panels, I would like to be able to
> > cursor around on the left side file and for the same (or nearly the same
> > line) to be centred and highlighted on the right side . .
> I might be simplifying it a bit, but how about going to the top of both
> files and executing:
>
> :windo set cursorbind scrollbind cursorline
>
> It seems to me that this would keep both files in sync and highlight the
> current line in both windows.

This seems like it should work, but I find that in Vim >= 7.3.547 the
other window's cursorline highlight is not updated until I do one of:
1. Focus the other window
2. :redraw!

This is the case for me even when I disable 'lazyredraw'.

:windo set nolazyredraw cursorbind scrollbind cursorline

A regular :redraw isn't enough, either. I must add the bang to get
the effect. Is there possibly another setting that I'm not thinking
of that could play a part in this?

--
Erik Falor http://unnovative.net
Registered Linux User #445632 http://linuxcounter.net
signature.asc

David Fishburn

unread,
Apr 13, 2013, 4:18:48 PM4/13/13
to vim_use
On Sat, Apr 13, 2013 at 2:51 AM, Philip Rhoades <ph...@pricom.com.au> wrote:
People,

With two text files open in vertical panels, I would like to be able to cursor around on the left side file and for the same (or nearly the same line) to be centred and highlighted on the right side . .

I am not certain what you end goal is after you have visually identified the different lines, but I did write a plugin to do something similar to this.

WhatsMissing.vim: Shows what is missing (or not) between 2 buffers

Is has 2 modes, word by word comparison or line by line.

Anyway, thought I would toss that out and let you read up on the web page if interested.

HTH,
David
 

Philip Rhoades

unread,
Apr 13, 2013, 9:41:11 PM4/13/13
to vim...@googlegroups.com
People,
Not quite what I want but interesting.

Thanks,

Phil.
--
Philip Rhoades

Philip Rhoades

unread,
Apr 13, 2013, 9:42:35 PM4/13/13
to vim...@googlegroups.com
David,


On 2013-04-14 06:18, David Fishburn wrote:
> On Sat, Apr 13, 2013 at 2:51 AM, Philip Rhoades <ph...@pricom.com.au>
> wrote:
>
>> People,
>>
>> With two text files open in vertical panels, I would like to be able
>> to cursor around on the left side file and for the same (or nearly the
>> same line) to be centred and highlighted on the right side . .
>
> I am not certain what you end goal is after you have visually
> identified the different lines, but I did write a plugin to do
> something similar to this.
>
> WhatsMissing.vim: Shows what is missing (or not) between 2 buffers
> http://www.vim.org/scripts/script.php?script_id=1108 [1]
>
> Is has 2 modes, word by word comparison or line by line.
>
> Anyway, thought I would toss that out and let you read up on the web
> page if interested.


Also not quite what I want but also interesting!
Reply all
Reply to author
Forward
0 new messages