I'd like to echo a custom message upon startup, based on whether or not certain startup functions were successful. I tried this in my .vimrc

echo 'test'

"All my settings

I'd like vim to echo a message as if I had just typed

echo 'foo'

from the command line after opening vim, but instead I get this obnoxious dialog box that comes up before my vim windows has even opened. I also tried

exe 'echo "test"'


silent echo 'test'

but neither of these worked.

  • 6
    you might need to postpone the echo until VimEnter has fired Commented Jul 20, 2016 at 17:22

1 Answer 1


You might want to use an autocommand that runs after VimEnter is triggered.

The autocommand can look something like this:

autocmd VimEnter * echo 'foo'

When vim starts up, it runs the command, and 'foo' is visible in the bottom left, as it would if you had just run the command.

You would put this autocommand somewhere in your .vimrc

  • how do we can use this logic (autocmd VimEnter * echo 'foo') for vi editor. we can still view the file without echo message in "vi".
    – Deepak
    Commented Feb 9, 2017 at 1:53
  • Something weird.. It's dumping partialy string conents to actual file contents on opening a new file. I think the o is interpreted as open line in insert mode.
    – mtk
    Commented Apr 25, 2020 at 14:03

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.