Wednesday, September 5, 2012

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

On 09/05/12 12:29, chroyer@comcast.net wrote:
> If I run gvim -d b.txt a.txt, things are as I expect: I see the
> added block of -1, few common lines, then the rest is folded.
>
> But if I run gvim -d a.txt b.txt, I don't initially see the block
> of -1. The vertical scrollbar is all the way to the top (I can't
> scroll up), the first 6 lines are shown with no diff, the rest is
> folded. If I just scroll with the mouse while on window of file
> a, nothing happens. Same if gg on a. But if click on the window
> where b is, the scroll bar is not partly down, and I can scroll
> up (or gg) to the top of b and see the diff.
>
> Am I the only one to see that?

I see it here (Vim7.2.445 on Linux, both vim and gvim) as well. I
also find it an unfortunate interface confusion.

> If not, would it be possible to have vim automatically scroll to
> show the top of the first diff block, regardless of which window
> it is in?

My first thought would be some autocmd or a manually-triggered
mapping, would ":windo if &diff | 0 | endif" to ensure that all diff
windows are at the top.

-tim


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