Wednesday, September 5, 2012

Re: Diff 2 files with lines added at top of second file: confusing

On 06/09/12 01:11, chroyer@comcast.net wrote:
>> :help diff.txt (section 1 "Starting diff mode")
>> Best regards,
>> Tony.
>
> Thank you, I had looked at the help, and tried to play with sbo and diffopt, but no success. I also tried to have both right and left scrollbars (using go+=rl) but again, no success. I tried those setting from the command line, e.g.
> gvim -d b.txt a.txt +"set go+=rl | windo 0"
> but I have not found a solution...
> Did you see something specific in the help that I missed (BTW, I am not sure I fully understand the help...)
> Thanks
> Christophe
>

Diff mode sets 'scrollbind', which in turn makes both windows scroll
together; however, you cannot scroll a window farther up than line 1.

By keyboard or mouse wheel (except by using the mouse wheel with the
mouse pointer on a scrollbar), you can scroll only the current window.
If its first line corresponds diff-wise to some line other than the
first in the other window, you cannot scroll the other window all the
way up that way.

There are two ways to scroll the other window farther up than the
current window's first line:
(a) Give it focus (by clicking in it, or by Ctrl-W w, etc.);
(b) Scroll it by its scrollbar. However, I haven't checked how this
works in diff mode.

Of course, there are only at most two scrollbars: if there are three or
more vertically split windows, only two of them (including the current
window) will have a scrollbar. If there are exactly three, the middle
one won't have a scrollbar unless it is current, in which case you may
have to experiment to see which side scrollbar corresponds to it.

To have both left and right scrollbars in gvim whenever there are
vertically split windows, make sure that 'guioptions' includes one of
the following (in any order):

lr always have scrollbars on both sides
lR scrollbar always on the left, also on the right when split
Lr scrollbar always on the right, also on the left when split

The default includes rL which is the latter case. I use

set go=gimrLTtc

which differs from the GTK default as follows (YMMV):

no a don't use autoselect
no e use a text-style tab bar, even in the GUI
c use console dialogs for simple choices

If you want to keep the existing 'guioptions' settings and add rl to
them, you should use

set go-=R go-=L go-=r go-=l go+=rl

Flags must be removed one by one because they can be in any order or
even some of them may be absent; using :set go-=RL go+=rl would only
remove RL if present next to each order in that sequence, and it would
add rl at the end even if either or both of them were already present.
(There is no error if you try to remove a flag that isn't there.)

And finally, if your vimrc invokes the vimrc_example.vim, you should
place your :set go=something command after coming back from the
vimrc_example.vim; or if your vimrc is a modified version of the
vimrc_example.vim, search for /guio/ and place your changes just after that.


If I shot beside the mark, then please explain better; maybe I hadn't
drunk enough black tea.


Best regards,
Tony.
--
ARTHUR: Be quiet!
DENNIS: --but by a two-thirds majority in the case of more--
ARTHUR: Be quiet! I order you to be quiet!
WOMAN: Order, eh -- who does he think he is?
ARTHUR: I am your king!
The Quest for the Holy Grail (Monty
Python)

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

Post a Comment