4

There are various questions and answers about disabling/blacklisting certain file types.

How do I disable syntastic for all but one filetype? (Let's say Python.)

  • 2
    Have you considered investing a few minutes in reading the manual? – lcd047 Oct 26 '15 at 20:20
  • Do you think on the syntax highlighting? – peterh Oct 27 '15 at 4:49
5

From the syntastic docs:

                                                       'syntastic_mode_map'
Default: { "mode": "active",
           "active_filetypes": [],
           "passive_filetypes": [] }

Use this option to fine tune when automatic syntax checking is done (or not done).

The option should be set to something like:

let g:syntastic_mode_map = {
    \ "mode": "active",
    \ "active_filetypes": ["ruby", "php"],
    \ "passive_filetypes": ["puppet"] }

"mode" can be mapped to one of two values - "active" or "passive". When set to "active", syntastic does automatic checking whenever a buffer is saved or initially opened. When set to "passive" syntastic only checks when the user calls :SyntasticCheck.

The exceptions to these rules are defined with "active_filetypes" and "passive_filetypes". In passive mode, automatic checks are still done for filetypes in the "active_filetypes" array (and "passive_filetypes" is ignored). In active mode, automatic checks are not done for any filetypes in the "passive_filetypes" array ("active_filetypes" is ignored).

If any of "mode", "active_filetypes", or "passive_filetypes" are left unspecified, they default to values above.

If local variable 'b:syntastic_mode' is defined its value takes precedence over all calculations involving 'syntastic_mode_map' for the corresponding buffer.

At runtime, the :SyntasticToggleMode command can be used to switch between active and passive modes.

You probably want something like:

let g:syntastic_mode_map = {
    \ "mode": "passive",
    \ "active_filetypes": ["python"],
    \ "passive_filetypes": [] }
  • 1
    Thanks, noticed that there's a missing '=' in the suggested answer. Should be "let g:syntastic_mode_map = { ... " – insidepower May 22 '16 at 7:53
1

You could disable syntax checking for a specific filetype by overriding the default checker and tell him to use none.

let g:syntastic_filetype_checkers['python'] = ['python'] " will use python as checker
let g:syntastic_filetype_checkers['python'] = []         " won't use any checker

You could set this option to be empty for every filetype you don't want to be checked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.