From 08e61a8c940356219b3a5c3f349af30fa6f78f8c Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Tue, 12 Jul 2011 10:59:41 +1200 Subject: [PATCH] automatically update errors when enabling/disabling syntax checkers If a user uses :SyntasticEnable or :SyntasticDisable, update the errors for the buffer automatically if possible --- plugin/syntastic.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 03a50ac8..a20728b8 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -304,6 +304,9 @@ function! s:Disable(...) if !empty(ft) && index(g:syntastic_disabled_filetypes, ft) == -1 call add(g:syntastic_disabled_filetypes, ft) endif + + "will cause existing errors to be cleared + call s:UpdateErrors() endfunction "enable syntax checking for the given filetype (defaulting to current ft) @@ -314,6 +317,13 @@ function! s:Enable(...) if i != -1 call remove(g:syntastic_disabled_filetypes, i) endif + + if !&modified + call s:UpdateErrors() + redraw! + else + echom "Syntasic: enabled for the '" . ft . "' filetype. :write out to update errors" + endif endfunction " vim: set et sts=4 sw=4: