Bram Moolenaar wrote:
Tony Mechelynck wrote:
Bug? With
gvim -o3 file1.txt file2.txt file3.txt
only the first two are displayed in a window. (All 3 files exist.)
The arguments list is OK, since
:bot new
:last
opens the 3rd file in a 3rd window.
If the line
set noea wmh=0 wh=99999 hh=99999
(in my vimrc) is changed to
au VimEnter * set noea wmh=0 wh=99999 hh=99999
(with no other changes in the vimrc), Vim opens all three windows at
startup. I suspect that the test for "is there enough space?" in the
handling of the -o command-line argument erroneously tests &winheight
instead of &winminheight.
This is vim 7.0.97 (Huge, for GTK2/Gnome).
'winheight' defines the minimal space for the current window. This is
taken into account when computing the number of windows opened for the
"-o" argument. Vim thinks you want one window with 'winheight' lines,
nothing else fits if it's a big number. I think this is correct
behavior. It's also documented in the help for 'winheight'.
'winminheight' defines the minimal space for any window; it is a hard
minimum. 'winheight' defines the "desired" minimal space for the current
window; it is not a hard minimum. Splitting a window will fail if it
would make all windows smaller than &wmh; it won't if it would only make
the current window smaller than &wh.
Setting 'wh' to a high value (and 'wmh' to zero) is documented as a way
to always make the current window as big as possible (what I call
Rolodex Vim). It is not meant to forbid splitting, and indeed it
doesn't. With 'wh' set to 99999 it is clear that I will never get a
window that high; yet it is (IMHO) a useful setting.
That ":all" won't open more than two windows if 'wh' is very large is
documented under 'winheight', and 'winheight' is referenced under
|:all|. There is no mention of |-o| under either 'winheight' or |:all|,
nor is there mention of 'winheight' or |:all| under |-o|. In retrospect,
and after reading your reply above, it is understandable that |-o| has
some of the properties of |:all|, though (unlike |:all| IIUC) it will
open more windows than files if the numeric argument is large enough.
But even the fact that it is documented (for |:all|, not for |-o|)
doesn't make this behaviour logical or desirable:
- Why will "-o3" (and, I presume, ":all 3") open a second window, but
not a third one, if the first one is _already_ smaller than 'winheight'?
- The fact that |-o| and |:all| won't allow as many splits as (repeated
invocations of) |:new| is IMHO a misfeature.
If you won't agree, well, you're the boss I guess. At least I have found
a workaround (for versions with +autocmd).
Best regards,
Tony.