0

If I add a command into my vimrc, such as:

:echom "Hello"

When I then open vim, I get the following:

LA-DEV-IM-MM:Avails david$ vim new
Hello!
Press ENTER or type command to continue

To better my understanding of how/when the vimrc is executed:

  • Why does Hello! print before "opening" vim?
  • Why does it say "Press ENTER or..." instead of just loading vim?

My thinking was that the echo command would do the following:

  • Open vim
  • Do nothing, but if I type in :messages the echom would show.

1 Answer 1

0

From the help:

:echom[sg] {expr1} ..
Echo the expression(s) as a true message, saving the message in the message-history.

The echom command is supposed to print the message when invoked, as well as saving it to be shown by messages.

You can test this behaviour by using it directly in your command line, e.g :echom "this is a test"

If you put this in your vimrc, it will be executed when Vim starts. That's why you see the message.

Finally, you get the press ENTER... prompt because that's what happens when the command-line gets overpopulated by a command output.
See :h cmdheight, which you can set to a higher value (default is 1, my recommendation would be 2) to avoid this.

Your Answer

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

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