Vim lint check - only show message if there's an error

Posted by GorillaSandwich on Super User See other posts from Super User or by GorillaSandwich
Published on 2011-02-08T13:52:05Z Indexed on 2011/02/08 15:28 UTC
Read the original article Hit count: 277

Filed under:
|

I have this line in my .vimrc, which means "when I save a .rb file, run it through ruby -c" (the ruby interpreter's error checking).

autocmd BufWritePost *.rb !ruby -c <afile>

When I save that file, I always see output at the bottom of the screen, so I get used to it and start ignoring it. What I want is to only see output if there are errors.

I can see that when there are errors, after it says what they are, at the bottom, it says "shell returned 1."

How can I modify this line so that it only shows a message if the shell returns 1? Is there a way to conditionally surpress output from a shell command run in vim?

© Super User or respective owner

Related posts about vim

Related posts about lint-check