Eno
Eno

Reputation: 10850

How to selectively disable checkers for certain file types when using syntastic in vim?

For example, HTML partial templates are being flagged with tons of errors but they are supposed to be fragments of a complete HTML doc.

Upvotes: 7

Views: 3930

Answers (3)

zoot
zoot

Reputation: 226

In .vimrc to ignore .env file for example:

let g:syntastic_ignore_files = ['.env']

From the :help syntastic:

Use this option to specify files that syntastic should never check. It's a list of |regular-expression| patterns. The full paths of files (see |::p|) are matched against these patterns, and the matches are case-sensitive. Use |\c| to specify case-insensitive patterns. Example:

let g:syntastic_ignore_files = ['\m^/usr/include/', '\m\c\.h$']

There's also another one, syntastic_<filetype>_<checker>_quiet_messages:

Finally, variables 'g:syntastic___quiet_messages' can be used to filter out some of the messages produced by specific checkers. The effect is identical to that of |syntastic_quiet_messages|, except only messages from the corresponding checkers are filtered. Example: >

let g:syntastic_python_pylama_quiet_messages = {"type": "style","regex": '\m\[C03\d\d\]' }

Upvotes: 1

safetycopy
safetycopy

Reputation: 554

In your .vimrc:

let g:syntastic_mode_map = {
    \ "mode": "active",
    \ "passive_filetypes": ["go"] }

This sets Syntastic to active mode (checks are made on save or open) but not for, in this case, Go files, which will be checked only when explicitly running :SyntasticCheck. Just change the array of passive_filetypes to whatever you need.

Upvotes: 15

Chris Carlile
Chris Carlile

Reputation: 21

You may be able to edit the settings for your particular HTML linter/checker but you can also add the following to your .vimrc or enter as a command:

au BufNewFile,BufRead *.html set b:syntastic_skip_checks = 1

au is autocommand, such that when a .html buffer is opened, syntastic skips checking it. The b: prefix only applies to the current buffer.

Upvotes: 0

Related Questions