Vim: Showing an error message from a Vim Script

message, status, vim

Solution

I think you are looking for `echoerr`.

Problem

I am trying to show an error message in a Vim script: ``` function! Foo() " ... endfunction au BufWritePost *.py silent call Foo() ``` The "throw" keyword works, but is probably not the right way to do this. I found references to "echomsg", but this doesn't have any effect: ``` echohl ErrorMsg echomsg 'Hello World' echohl NONE ``` I also tried to write into v:statusmsg (also no effect). Any idea? In addition, I'd probably also want to stop the signal propagation like throw() does, i.e. such that other hooks that listen to the BufWritePost event are not called.

Original source