Quantcast

scrollbind

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

scrollbind

luis jure
hello vim list,

i need to edit two files side by side, so i split windows vertically and set
scrollbind in both.

but the files have slightly different distribution of lines, and after
scrolling a few pages they are out of sync. so i have to unset scrollbind in
one of them, synchronize both files, and set scrollbind again.

perhaps i'm being a nuisance, but what i want is that scrolling window A
scrolls _both_ windows, but scrolling window B scrolls _only_ window B.

is it possible to do that? if not, could it be possible?

thanks for you attention,

lj



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: scrollbind

Peter Hodge-2
Hey Luis,

Unfortunately I don't know a quick and easy way to get one window to scroll
differently than the other ... as a temporary solution you could diff the two
files and open all folds.

  vimdiff file1.txt file2.txt
or
  vim -d file1.txt file2.txt

Once inside vim, type 'zR' (lowercase 'z', uppercase 'R') in normal mode to
open all the folds.  You should then have the two files displayed side-by-side
with visible gaps whenever lines are missing in one or the other file - the
scrolling will stay in sync.

regards,
Peter





--- luis jure <[hidden email]> wrote:

> hello vim list,
>
> i need to edit two files side by side, so i split windows vertically and set
> scrollbind in both.
>
> but the files have slightly different distribution of lines, and after
> scrolling a few pages they are out of sync. so i have to unset scrollbind in
> one of them, synchronize both files, and set scrollbind again.
>
> perhaps i'm being a nuisance, but what i want is that scrolling window A
> scrolls _both_ windows, but scrolling window B scrolls _only_ window B.
>
> is it possible to do that? if not, could it be possible?
>
> thanks for you attention,
>
> lj
>
>
>
>



               
____________________________________________________
Do you Yahoo!?
Listen to over 20 online radio stations and watch the latest music videos on Yahoo! Music.
http://au.launch.yahoo.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: scrollbind

A.J.Mechelynck
In reply to this post by luis jure
luis jure wrote:

> hello vim list,
>
> i need to edit two files side by side, so i split windows vertically and set
> scrollbind in both.
>
> but the files have slightly different distribution of lines, and after
> scrolling a few pages they are out of sync. so i have to unset scrollbind in
> one of them, synchronize both files, and set scrollbind again.
>
> perhaps i'm being a nuisance, but what i want is that scrolling window A
> scrolls _both_ windows, but scrolling window B scrolls _only_ window B.
>
> is it possible to do that? if not, could it be possible?
>
> thanks for you attention,
>
> lj
>
>
>
>
>
>

Using the mouse and the scrollbars, if you scroll the currently inactive
window (the one without the cursor), you scroll only that one. If you
scroll the active window, they both scroll together.

See ":help scrollbind-quickadj".

HTH,
Tony.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: scrollbind

Suresh Govindachar`
 A. J. Mechelynck Sent on 23 Oct 2005 14:40:34 +0200:
  luis jure wrote:

>> hello vim list,
>>
>> i need to edit two files side by side, so i split windows vertically and set
>> scrollbind in both.
>>
>> but the files have slightly different distribution of lines, and after
>> scrolling a few pages they are out of sync. so i have to unset scrollbind in
>> one of them, synchronize both files, and set scrollbind again.
>>
>> perhaps i'm being a nuisance, but what i want is that scrolling window A
>> scrolls _both_ windows, but scrolling window B scrolls _only_ window B.
>>
>> is it possible to do that? if not, could it be possible?
>>
>> thanks for you attention,
>>
>> lj
>>
>
> Using the mouse and the scrollbars, if you scroll the currently inactive
> window (the one without the cursor), you scroll only that one. If you
> scroll the active window, they both scroll together.
>
> See ":help scrollbind-quickadj".
>
> HTH,
> Tony.

  Surprised to find that VIM has a feature for mouse users that is
  not available for keyboard users!  (I use vim without menus,
  toolbars or scrollbars.)  

  --Suresh

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: scrollbind

Charles E Campbell Jr
In reply to this post by luis jure
luis jure wrote:

>i need to edit two files side by side, so i split windows vertically and set
>scrollbind in both.
>
>but the files have slightly different distribution of lines, and after
>scrolling a few pages they are out of sync. so i have to unset scrollbind in
>one of them, synchronize both files, and set scrollbind again.
>
>perhaps i'm being a nuisance, but what i want is that scrolling window A
>scrolls _both_ windows, but scrolling window B scrolls _only_ window B.
>
>is it possible to do that? if not, could it be possible?
>  
>
Sure, its possible.  Tony mentioned using inactive scrollbars;  may I
suggest using local maps.
Basically, the idea is to dactivate scrollbind whenever one enters one
window, but to re-activate
it when entering the other.  So, I suggest putting the following in some
function...

fun! StartScbNoscb()
  augroup SCBNOSCB
    au!
    au WinEnter * if winnr() == 1|set scb|endif
    au WinEnter * if winnr() == 2|set scb|endif
    au WinLeave * if winnr() == 1|set noscb|endif
   augroup END
   norm! zR
   wincmd l
   norm! zR
   wincmd h
endfun

(you can put this into a plugin directory file or in your <.vimrc>).  Then
:call StartScbNoscb()

when you want.  Clearing this effect is an exercise left to the reader.

Regards,
Chip Campbell

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: scrollbind

Keith W. Roberts
In reply to this post by luis jure
----Original Message----
From: Charles E. Campbell, Jr. [mailto:[hidden email]]
Sent: Monday, October 24, 2005 12:15 PM
To: luis jure
Cc: Vim list
Subject: Re: scrollbind

> luis jure wrote:
>
>> i need to edit two files side by side, so i split windows vertically
>> and set scrollbind in both.
>>
>> but the files have slightly different distribution of lines, and
>> after scrolling a few pages they are out of sync. so i have to unset
>> scrollbind in one of them, synchronize both files, and set
>> scrollbind again.
>>
>> perhaps i'm being a nuisance, but what i want is that scrolling
>> window A scrolls _both_ windows, but scrolling window B scrolls
>> _only_ window B.
>>
>> is it possible to do that? if not, could it be possible?
>>
>>
> Sure, its possible.  Tony mentioned using inactive scrollbars;  may I
> suggest using local maps. Basically, the idea is to dactivate
> scrollbind whenever one
> enters one
> window, but to re-activate
> it when entering the other.  So, I suggest putting the
> following in some
> function...
>
> fun! StartScbNoscb()
>   augroup SCBNOSCB
>     au!
>     au WinEnter * if winnr() == 1|set scb|endif
>     au WinEnter * if winnr() == 2|set scb|endif
>     au WinLeave * if winnr() == 1|set noscb|endif
>    augroup END
>    norm! zR
>    wincmd l
>    norm! zR
>    wincmd h
> endfun
>
> (you can put this into a plugin directory file or in your
> <.vimrc>).  Then
>> call StartScbNoscb()
>
> when you want.  Clearing this effect is an exercise left to
> the reader.
>
> Regards,
> Chip Campbell

Hey, I like this!  Thanks!  I'm going to steal this technique for my
diff maps (I hate having to do zR in both buffers before I can scroll
through them).

-Keith
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: scrollbind

luis jure
In reply to this post by Charles E Campbell Jr
el Mon, 24 Oct 2005 15:15:23 -0400
"Charles E. Campbell, Jr." <[hidden email]> escribi?:

> Sure, its possible.  Tony mentioned using inactive scrollbars;  may I
> suggest using local maps.
> Basically, the idea is to dactivate scrollbind whenever one enters one
> window, but to re-activate
> it when entering the other.  So, I suggest putting the following in some
> function...

thanks both of you, the trick of using the scrollbar works, but this
function is really great! no need to use the mouse...

best,

lj
Loading...