Ignore errors and warnings for a VIM plugin

Ionică Bizău picture Ionică Bizău · Aug 6, 2014 · Viewed 7.3k times · Source

Suppose I have a VIM plugin that is very useful, but it generates a lot of errors/warnings that I don't care for.

How can I ignore all errors from that plugin? I just want to be disturbed by these messages anymore.

Is there any setting/function call that turns off such things?

I know that the best thing would be to report this as issue, but how can I just make them not appear?

Example of errors:

Answer

Ingo Karkat picture Ingo Karkat · Aug 6, 2014

Well, I would definitely look into the root cause of the errors, as it might affect the plugin's functionality. At least this should allow you to send a precise bug report to the plugin's author.

Errors and warnings can be suppressed via the :silent! (note the !) command. Basically, any Ex command can be prefixed with it. So, if you have a :TroublesomeCommand, you can silence the errors via

:silent! TroublesomeCommand

To silence the plugin (if you really must), you can might be able to redefine its mappings (to include :silent!) and commands, but the use of <SID> may force you to modify the plugin itself. In that case, you can also put the :silent! directly before the offending command (the error should include its location), but again, fixing the root cause would be preferable.