diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 84fcc868..fb140054 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -459,9 +459,19 @@ 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. + *'b:syntastic_mode'* +Default: unset +Only the local form |'b:syntastic_mode'| is used. When set to either "active" +or "passive", it takes precedence over |'syntastic_mode_map'| when deciding +whether the corresponding buffer should be checked automatically. + *'syntastic_quiet_messages'* Default: {} Use this option to filter out some of the messages produced by checkers. The diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 4665e87d..d8c93e5a 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -291,7 +291,7 @@ function! s:UpdateErrors(auto_invoked, checker_names) " {{{2 endif call s:modemap.synch() - let run_checks = !a:auto_invoked || s:modemap.allowsAutoChecking(&filetype) + let run_checks = !a:auto_invoked || s:modemap.doAutoChecking() if run_checks call s:CacheErrors(a:checker_names) endif diff --git a/plugin/syntastic/modemap.vim b/plugin/syntastic/modemap.vim index 3d9a2966..67299047 100644 --- a/plugin/syntastic/modemap.vim +++ b/plugin/syntastic/modemap.vim @@ -38,6 +38,15 @@ function! g:SyntasticModeMap.allowsAutoChecking(filetype) " {{{2 endif endfunction " }}}2 +function! g:SyntasticModeMap.doAutoChecking() " {{{2 + let local_mode = get(b:, 'syntastic_mode', '') + if local_mode ==# 'active' || local_mode ==# 'passive' + return local_mode ==# 'active' + endif + + return self.allowsAutoChecking(&filetype) +endfunction " }}}2 + function! g:SyntasticModeMap.isPassive() " {{{2 return self._mode ==# 'passive' endfunction " }}}2