samoshkin/vim-mergetool

Using g:MergetoolSetLayoutCallback for equal sized windows doesn't work on initial MergetoolStart

idbrii opened this issue · 1 comments

I want equal sized windows whenever mergetool lays out the windows.

function s:on_mergetool_set_layout(split)
    wincmd =
endfunction
let g:MergetoolSetLayoutCallback = function('s:on_mergetool_set_layout')

This works for MergetoolToggleLayout (switching between lmr and lm), but not the initial layout from MergetoolStart.

Using gvim started like this (see #17) :

gvim --nofork -c "simalt ~x" -c "let g:mergetool_args_order = 'MBLR'" -c "Merge" "%MERGED%" "%BASE%" "%LOCAL%" "%REMOTE%"

Turns out simalt ~x (maximize) doesn't tell vim how wide it is fast enough or something. This can be reproduced without vim-mergetool:

gvim --nofork +"simalt ~x" +vsplit +vsplit +"wincmd ="

The solution is to explicitly set columns to it's maximum before using simalt

gvim --nofork +"set columns=9999" +"simalt ~x" +vsplit +vsplit +"wincmd ="

And the correct command for launching vim-mergetool:

gvim --nofork +"set columns=9999" +"simalt ~x" +"let g:mergetool_args_order = 'MBLR'" +"Merge" "%MERGED%" "%BASE%" "%LOCAL%" "%REMOTE%"