On 06/09/12 05:15, [email protected] wrote:

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

Tony.

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


Try loading the two files without the diff mode:

        gvim -O2 "+windo 1" file1.txt file2.txt

This will display both files side by side and both scrolled to the top. (in -O2 the O is a capital letter O, not a zero, to split vertically.) Then you can do

        :windo diffthis

if you want to set diff mode in all (i.e. both) files currently being viewed. You can of course reduce the number of keystrokes by assigning this to a key:

        :map <F4> :windo diffthis<CR>

Similarly, you can create a command to invoke gvim as above as if it were a simple command:

-Windows- gvimnodiff.bat (in some directory in the %PATH%)
"C:\Program Files\vim\gvim.exe" -O2 "+windo 1" %1 %2

-Unix- ~/bin/gvimnodiff
#!/bin/bash
gvim -O2 '+windo 1' $1 $2

See also
        :help zR
        :help zM
about two useful commands (to open and close all folds, respectively).


Best regards,
Tony.
--
If clear thinking created sparks, we could safely store dynamite in
James Watt's office.
                -- Wayne Shannon, KRON-TV

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

Reply via email to