Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoldenView breaks vimdiff 4-pane layout #33

Open
easoncxz opened this issue Aug 10, 2020 · 0 comments
Open

GoldenView breaks vimdiff 4-pane layout #33

easoncxz opened this issue Aug 10, 2020 · 0 comments

Comments

@easoncxz
Copy link

I enjoy using vim as my Git merge-tool, and have done so for a while. When I run git mergetool, I'm used to a vimdiff layout like this: (diagram copied from a vim StackExchange post)

-------------------------
| LOCAL | BASE | REMOTE |
-------------------------
|        MERGED         |
-------------------------

However from some unknown point in time onwards (in hindsight, it was perhaps after I started using GoldenView), this four-pane layout got messed up. I instead have got a layout like this:

-------------------------
| LOCAL | BASE | REMOTE |
-------------------------

After poking around my vim setup on and off for a long time, today it finally crossed my mind to try launching vimdiff via vim -u NONE to debug things, and lo and behold, I see all four panes like I expected from the old days. I then made a guess among my plugins that perhaps GoldenView, the only plugin that does something about my splits, may have some strange interactions.

I tried disabling GoldenView for diffmode by using this unusual line in my plugin definition: (I use vim-plug)

call plug#begin('~/.vim/plugged')

" ... other plugins

" Activate GoldenView unless vim is launched in diffmode
if (&diff == 0)
    Plug 'zhaocai/GoldenView.Vim'
endif

" ... other plugins

call plug#end()

I dug around to find what kind of command-line Git uses to launch vim as a difftool/mergetool, and found this via StackOverflow:

vim -d $MERGED $LOCAL $BASE $REMOTE -c wincmd J

So I created four files for testing:

echo one > one
echo two > two
echo three > three
echo four > four

And then launched vim using this command:

vim -c 'wincmd J' -d one two three four

And voila, I see four panes as I wanted:

image

To check that indeed GoldenView is interfering with vim diffmode somehow, I tried doing the same thing but with GoldenView activated. I changed my ~/.vimrc back to its previous state (i.e. the state in which I could not get vimdiff to show four panes):

call plug#begin('~/.vim/plugged')

" ... other plugins

" Activate GoldenView unless vim is launched in diffmode
"if (&diff == 0)
    " Debugging: Always load GoldenView, regardless of whether vim is in diffmode
    Plug 'zhaocai/GoldenView.Vim'
"endif

" ... other plugins

call plug#end()

And behold, the layout is messed up again --- only the first three of the four panes are showing:

image

I didn't put in the time to make a minimal ~/.vimrc, but I think this is evidence enough that GoldenView somehow has some interactions with how vim functions as a Git mergetool. I also haven't read the GoldenView code yet, but regardless of whether anything is done in GoldenView to address this issue, hopefully my post here would be helpful to someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant