diff --git a/doc/syntastic.txt b/doc/syntastic.txt index efa8355c..73861564 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -299,6 +299,12 @@ e.g. > let g:syntastic_python_checkers = ['flake8'] < +There's also a per-buffer version of this setting, b:syntastic_checkers. Use +this in an autocmd to configure specific checkers for particular paths: > + autocmd FileType python if stridx(expand('%:p'), '/some/path/') == 0 | + \ let b:syntastic_checkers = ['pylint'] | endif +< + To see the list of available checkers for your filetype, look in `syntax_checkers//`. The names of the files here correspond to '' above. diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 02c25391..d8396d1b 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -110,7 +110,11 @@ function! g:SyntasticRegistry._filterCheckersByDefaultSettings(checkers, filetyp endfunction function! g:SyntasticRegistry._filterCheckersByUserSettings(checkers, filetype) - let whitelist = g:syntastic_{a:filetype}_checkers + if exists("b:syntastic_checkers") + let whitelist = b:syntastic_checkers + else + let whitelist = g:syntastic_{a:filetype}_checkers + endif return filter(a:checkers, "index(whitelist, v:val.name()) != -1") endfunction @@ -135,7 +139,7 @@ function! g:SyntasticRegistry._haveLoadedCheckers(filetype) endfunction function! g:SyntasticRegistry._userHasFiletypeSettings(filetype) - return exists("g:syntastic_" . a:filetype . "_checkers") + return exists("b:syntastic_checkers") || exists("g:syntastic_" . a:filetype . "_checkers") endfunction function! g:SyntasticRegistry._validateUniqueName(checker) abort