Vim lint check - only show message if there's an error
- by GorillaSandwich
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?