Sunday, March 30, 2014

Re: Suggestion for vim -diff behavior change

On Sun, Mar 30, 2014 at 10:27 AM, Bram Moolenaar <Bram@moolenaar.net> wrote:
>
> Justin Keyes wrote:
>
>> On Fri, Mar 28, 2014 at 4:53 PM, Josef Fortier <josef.fortier@gmail.com> wrote:
>> > I've only really actively used diff mode recently (as opposed to using it as a visual diff tool). The default folding update on a change has led me astray more then once.
>> >
>> > I've learned the workaround only today, zo and zc, but the auto-folding behavior seems to me to be a real UI issue. I believe that diff mode should:
>> >
>> > * leave the initial folding alone (it's quite useful)
>> > * leave the change markers in place (this is less important)
>> > * but **not** refold.
>> >
>> > In almost all diff resolution workflows I can imagine, we want to **review** the changes. Auto-folding assumes that we are omniscient and do not need to review.
>>
>> I agree. The initial folding is welcome, but auto-folding after 'do'
>> or 'dp' is jarring. You are talking about do/dp, right?
>
> So then do:
> :set foldmethod=manual
>
> It will keep the current folds.

Thanks Bram! Setting that on both of the diff windows achieves the
desired effect. To do this automatically when entering Vim in
diff-mode, I added this to vimrc:

autocmd VimEnter * if &diff | exe 'windo set foldmethod=manual' | endif

Then, diff-mode initializes with folded text, but 'do' and 'dp' will
not auto-fold.

The Vim wiki[1] implies that &diff is set before vimrc is sourced, but
that isn't the case for me on Mac OS terminal Vim, nor Windows
terminal Vim (invoked via "vim -d a.txt b.txt").

[1] http://vim.wikia.com/wiki/Ignore_white_space_in_vimdiff

Justin M. Keyes

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: