From 9a9da9449462f592e5093e4cf9a56fcc2d947a72 Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Sat, 24 Dec 2011 01:33:07 +0100 Subject: [PATCH] evaluate g:syntastic_check_on_open without having to restart vim --- plugin/syntastic.vim | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 768300ed..36468fbd 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -77,10 +77,6 @@ if !has_key(g:syntastic_mode_map, "passive_filetypes") let g:syntastic_mode_map['passive_filetypes'] = [] endif -if !exists("g:syntastic_check_on_open") - let g:syntastic_check_on_open = 0 -endif - command! SyntasticToggleMode call s:ToggleMode() command! SyntasticCheck call s:UpdateErrors(0) redraw! command! Errors call s:ShowLocList() @@ -93,8 +89,8 @@ augroup syntastic autocmd cursormoved * call s:EchoCurrentError() endif - let events = g:syntastic_check_on_open ? "BufReadPost,BufWritePost" : "BufWritePost" - exec "autocmd " . events . " * call s:UpdateErrors(1)" + autocmd BufReadPost * if exists('g:syntastic_check_on_open') && g:syntastic_check_on_open != 0 | call s:UpdateErrors(1) | endif + autocmd BufWritePost * call s:UpdateErrors(1) autocmd BufWinEnter * if empty(&bt) | call s:AutoToggleLocList() | endif autocmd BufWinLeave * if empty(&bt) | lclose | endif