views:

219

answers:

2

Title really says it all. There is the -O option for opening splits vertically, and -o for horizontally, but trying to mix them doesn't seem to work.

My goal is to use g/vimdiff for 3-way file merging in mercurial in a way more like kdiff3 does. This method would have the 3 files to be merged split into 3 vertical tabs across the top (my local version, the other version of the file I am merging it with, and the base version between the two), while the "output", or results of the merge, is a large horizontal tab stretched across the bottom.

+1  A: 

Although Vim allows you to supply more than 2 files to be diffed, it doesn't particularly work very well for doing more than a 2-way diff.

At any rate, you're correct that you can't specify different ways to split using both -O and -o. The best you'll get is either sourcing a script to run (via -S 3way.vim) or using --cmd arguments to setup the splits and change which buffers are displayed in those splits.

A potential 3way.vim, assuming you invoke vim as vim -S 3way.vim localfile otherversion baseversion merged would be

botright vsplit +b2  " Opens a split and focuses otherversion
botright vsplit +b3  " Opens a split and focuses baseversion
botright split +b4   " Opens a split and focuses merged
wincmd =             " Resize all windows so they share space equally
jamessan
+1  A: 

This is a little kludgy, but it works:

vim -c "wincmd J" -O base diff1 diff2

(That's a verbatim control-W there)

Maybe there's a more elegant method, but this simply loads all of them as vertical and then moves the active (first) one to the bottom.

Jefromi
The "more elegant" way would be to use `wincmd J` instead.
jamessan
Well, yours is more what I was thinking of as elegant, though you're right about that. (Of course I'm not sure how much difference there is internally between `wincmd {arg}` and `normal ^W{arg}`)
Jefromi
I love a good kludge, and this does the job. Specifically add a little bit of this in the .hgrc: filemerge.args = -c "wincmd J" -g -d -O $output $local $other $base