Thank you Tony, I appreciate your time giving me all those details. I will try a couple more things (I might have misused set go+=/set go-=).
But with my original settings, and others I tried (including left and right scroll bars) , I can always see the diff, but *not* initially: I have to click and scroll, and that's too much intervention, too easy to forget.
Background: I have been using gvim as my diff viewer for tortoise svn. It works great, except that recently I committed unwanted changes (at the top of a file) because I forgot to click on the correct window and scroll. The diff initially displays like there is no line added at the top of the file (and I did not expect any either).
I would like vim to automatically scroll to the "highest" of the 2 files (either by code change, auto command, script, whatever...).
I was really happy about using gvim -d file1 file2 +"windo 0" but it only works when file1 has more lines (or maybe the reverse, I forgot). I want a reliable way to start my diff.
I'm fairly sure this can be explained with the current mechanisms in vim, but it does not give me the behavior that I would like.
I'll try looking at which vim functions are available and see if this could be done with a script (focus on the windows where the first added block is and scroll to the top of that window?).
Thanks again,
Christophe
Thank You! I completely agree! (Vim is already doing just about anything else right!)
> here is a patch:
[...]
> Christian
Thank you,
I tried your patch, and I think it only works when I call
gvim -d a.txt b.txt
If I switch a and b, I have the same issue...
gvim -d b.txt a.txt
In the meantime (as I still prefer a patch), this seems to be working when calling from the command line:
gvim -d b.txt a.txt +"if diff_filler(1) | winc w |endif | 0"
in my case, I only compare 2 files, so I check if the file in the current window as filler lines above line 1; if so, I move to the other window. Then, in the active window after that, I go to the top of the file.
Christophe
FYI, I am now using an auto command instead so that it does not matter how I call the diff (on Windows, I also wanted this to behave properly when using gvimext "diff with vim".
Here is what I have in my _vimrc until something better comes up;
au VimEnter * if &diff && diff_filler(1) | winc w | endif | 0
Christophe
Thank you Christian, the patch works for me (and yes, I removed my autocommand to test the patch). Very nice.
Christophe.