refactor g:syntastic_check_on_open

init g:syntastic_check_on_open with the rest of the options - this means
we only check exists("...") once rather than every time the autocmd is
run. Plus it reads better IMO.
This commit is contained in:
Martin Grenfell 2011-12-24 09:44:01 +00:00
parent 9a9da94494
commit d88db85b07

View File

@ -77,6 +77,10 @@ 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) <bar> redraw!
command! Errors call s:ShowLocList()
@ -89,7 +93,7 @@ augroup syntastic
autocmd cursormoved * call s:EchoCurrentError()
endif
autocmd BufReadPost * if exists('g:syntastic_check_on_open') && g:syntastic_check_on_open != 0 | call s:UpdateErrors(1) | endif
autocmd BufReadPost * if g:syntastic_check_on_open | call s:UpdateErrors(1) | endif
autocmd BufWritePost * call s:UpdateErrors(1)
autocmd BufWinEnter * if empty(&bt) | call s:AutoToggleLocList() | endif