简体   繁体   中英

Why can't vim process .vimrc when winheight option isn't set twice?

I'm using the following options to make the split I'm focussing on the biggest on the screen. When bouncing between splits, window sizes get updated accordingly:

set winwidth=84
set winheight=5
set winminheight=5
set winheight=999

That works fine, however, you see that there are two definitions of winheight , which is kind of odd. I removed the first winheight declaration to see if things would work the same. Unfortunately, vim throws the error that it can't process my .vimrc file.

So, to clarify things, I stole this configuration from somebody's .vimrc. There must be a reason, why this options has to be set twice but I couldn't find something useful in the help.

Do you know, why vim throws the error in that case?

If the error you're getting is E591 :

E591: 'winheight' cannot be smaller than 'winminheight': winminheight=5

the problem may be simply one of ordering. By default, winheight is 1 . Without the first winheight setting, you're attempting to set a winminheight larger than the current winheight , which obviously causes problems (and results in the error).

I think that the duplicate declaration is also simply a matter of ordering. Attempting to start Vim up with the winheight=999 moved up before the winminheight setting gives me the alternate error

E36: Not enough room

Thus, if you want both to set the winheight to its maximum ( 999 ) and to set the winminheight to something more reasonable than its default ( 1 ), this may be the only workable approach.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM