Merge pull request #532 from dbarnett/per_buffer

Add support for buffer-local b:syntastic_checkers var.
This commit is contained in:
Martin Grenfell 2013-03-04 01:17:25 -08:00
commit b480992ae8
2 changed files with 12 additions and 2 deletions

View File

@ -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/<filetype>/`. The names of the files here correspond to
'<checker-name>' above.

View File

@ -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