0

Working from home on a travel laptop makes one very stingy with screen space. I often have Vim taking up the right-most third of the screen and split up into 2-3 vertically stacked subwindows. Sometimes, I want them equal height (Ctrl+w+=) while other times, I maximize the height of the current window (Ctrl+w+_).

With (Ctrl+w+_), Vim used to leave at least one line of text visible in the other windows. With Vim 8.2, I find there are zero lines of visible text in the other subwindows, and only their status lines show. For me, this is not a strong enough reminder that I have other subwindows squished along the top and/or bottom.

Is there any way to specify that the number of visible lines of text for all subwindows can only drop as low as 1 and not to 0?

I mean without having to switch into the other windows.

2
  • Hm, can you check what this outputs: :verbose set winminheight? Commented Mar 31, 2022 at 19:31
  • Aha! It is set to zero, and apparently last set from a session.x.vim file that I create to save my tabs, subwindows, and recent files -- and which I subsequently source. Command :set winminheight=1 fixes the problem. I've never heard of winminheight or wmh before, and it isn't in /etc/vimrc (and I don't have a personal ~/.vimrc). So it's a mystery how the setting got set to zero. Fingers crossed that it doesn't happen often, but now I know how to fix it. Thanks! Would you like to post the answer? Commented Mar 31, 2022 at 19:43

1 Answer 1

2

This behaviour, how much a window can be minimized is influenced by the 'winminheight' option:

The minimal height of a window, when it's not the current window. This is a hard minimum, windows will never become smaller. When set to zero, windows may be "squashed" to zero lines (i.e. just a status bar) if necessary. They will return to at least one line when they become active (since the cursor has to have somewhere to go.) Use 'winheight' to set the minimal height of the current window. This option is only checked when making a window smaller. Don't use a large number, it will cause errors when opening more than a few windows. A value of 0 to 3 is reasonable.

Note that by default it is 1, so a window should never be completely collapsed. To find out what the current value is (and where it is set) you can use:

:verbose set winminheight?

This should give a hint where it is last set so you can adjust accordingly.

1
  • Thanks, Christian. It's odd that the question even needs posting, but Googling vim minimum-window-height doesn't turn up the winminheight option. Maybe once this page gets indexed, it will. Commented Apr 1, 2022 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.