Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: Showing an error message from a Vim Script

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.

like image 501
knipknap Avatar asked Feb 22 '10 17:02

knipknap


1 Answers

I think you are looking for echoerr.

like image 185
Randy Morris Avatar answered Oct 22 '22 13:10

Randy Morris