Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why setting the command window height to 2 lines, avoid many cases of having to "press <Enter> to continue"?

Tags:

vim

I found this on my .vimrc:

Set the command window height to 2 lines, to avoid many cases of having to
" "press <Enter> to continue"
set cmdheight=2

And this causes this extra space at the bottom of the page: enter image description here

And if I set it to set cmdheight=1, then I got a smaller space: enter image description here

I do not understand I need to set cmdheight=2. What are these many cases of having to "press <Enter> to continue"?

It seems nice to not have to keep pressing enter repeatedly (for whatever reason it is), but why I need to lose one (1) line of vertical space in the screen for that?

like image 302
user Avatar asked Oct 24 '25 04:10

user


1 Answers

The press-enter prompt appears if the cmdline area is not big enough to display a text.

E.g. a plugin prints more lines then what 'cmdheight' is set to. It even happens when cmdheight=1, but the line to be printed is longer than the width of the window.

:set cmdheight=1
:echomsg "foo" | echomsg "bar"

IMHO, setting 'cmdheight' to 2 or higher is not worth it, because it simply looks ugly and steals space to work around a not too common press-enter prompt.

Rather plugins should take it into account and "flush" their messages via :redraw:

:echomsg "foo" | redraw | echomsg "bar"

Now, you'll only see the latter message, but still find the former one in the message history via :messages.

See :h press-enter for more information on this.

like image 68
mhinz Avatar answered Oct 26 '25 22:10

mhinz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!