Re: [PATCH 0/2] mergetools: vimdiff3: fix regression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22/08/02 04:41PM, Felipe Contreras wrote:
> Hello,
> 
> I wrote vimdiff3 to leverage both the power of git's diff3 and vim's
> diff mode, but commit 0041797449 broke that.
> 

Hi Felipe,

This is the command that runs now when using 'git merge -t vimdiff3':

    vim -c "echo | 4b | bufdo diffthis" -c "tabfirst" LOCAL BASE REMOTE MERGED

...and this is the command that runs after your patch:

    vim -d -c "setl diffopt-=closeoff diffopt-=hiddenoff | hid | hid | hid" LOCAL BASE REMOTE MERGED

The new command you suggest is meant to improve two aspects:

    1. Preserves diff colors.
    2. Removes the "Press ENTER" message.

Regarding (1) I never noticed this because in my tests colors were always
shown...  but I just tried to run with '-u NONE' (which prevents .vimrc from
being loaded) and you are right: there are now no colors.

    vim -u NONE -c "echo | 4b | bufdo diffthis" -c "tabfirst" LOCAL BASE REMOTE MERGED
        ^^^^^^^
        `-> Tell vim not to load .vimrc

So... I started looking into my .vimrc and found the "problem":

    set hidden

By default this option is *not* set, which means buffers are discarded when
hidden (and that's why diff colors dissapear). By setting this option colors are
back even with '-u NONE':

    vim -u NONE -c "echo | set hidden | 4b | bufdo diffthis" -c "tabfirst" LOCAL BASE REMOTE MERGED
                           ^^^^^^^^^^

Regarding (2) we can remove the "Press ENTER" message by adding "silent" to both
"4b" and "bufdo", like this:

    vim -u NONE -c "echo | set hidden | silent 4b | silent bufdo diffthis" -c "tabfirst" LOCAL BASE REMOTE MERGED
                                        ^^^^^^      ^^^^^^

So... by making two changes to the current implementation (adding "set hidden"
and "silent") we can make it work. The nice thing is that, this way, "vimdiff3"
does not need to be treated as an exception and thus it will be (hopefully)
easier to maintain.

What do you think? :)

Thanks!

Fernando.

PS: I'll reply to this message with a patch that implements this in case we
decide to go this route.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux