diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index a2713d0d..e2c56c9d 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -466,8 +466,8 @@ endfunction "load the chosen checker for the current filetype - useful for filetypes like "javascript that have more than one syntax checker -function! s:LoadChecker(checker) - exec "runtime syntax_checkers/" . &ft . "/" . a:checker . ".vim" +function! s:LoadChecker(checker, ft) + exec "runtime syntax_checkers/" . a:ft . "/" . a:checker . ".vim" endfunction "return a string representing the state of buffer according to @@ -602,22 +602,24 @@ endfunction "well as the names of the actual syntax checker executables. The checkers "should be listed in order of default preference. " -"if a option called 'g:syntastic_[filetype]_checker' exists then attempt to +"a:ft should be the filetype for the checkers being loaded +" +"if a option called 'g:syntastic_{a:ft}_checker' exists then attempt to "load the checker that it points to -function! SyntasticLoadChecker(checkers) - let opt_name = "g:syntastic_" . &ft . "_checker" +function! SyntasticLoadChecker(checkers, ft) + let opt_name = "g:syntastic_" . a:ft . "_checker" if exists(opt_name) let opt_val = {opt_name} if index(a:checkers, opt_val) != -1 && executable(opt_val) - call s:LoadChecker(opt_val) + call s:LoadChecker(opt_val, a:ft) else echoerr &ft . " syntax not supported or not installed." endif else for checker in a:checkers if executable(checker) - return s:LoadChecker(checker) + return s:LoadChecker(checker, a:ft) endif endfor endif diff --git a/syntax_checkers/go.vim b/syntax_checkers/go.vim index 395ae11b..6d78b480 100644 --- a/syntax_checkers/go.vim +++ b/syntax_checkers/go.vim @@ -19,4 +19,4 @@ endif let loaded_go_syntax_checker = 1 let s:supported_checkers = ["6g", "gofmt"] -call SyntasticLoadChecker(s:supported_checkers) +call SyntasticLoadChecker(s:supported_checkers, 'go') diff --git a/syntax_checkers/javascript.vim b/syntax_checkers/javascript.vim index 026c7371..3d5236c4 100644 --- a/syntax_checkers/javascript.vim +++ b/syntax_checkers/javascript.vim @@ -20,4 +20,4 @@ endif let loaded_javascript_syntax_checker = 1 let s:supported_checkers = ["gjslint", "jslint", "jsl", "jshint"] -call SyntasticLoadChecker(s:supported_checkers) +call SyntasticLoadChecker(s:supported_checkers, 'javascript') diff --git a/syntax_checkers/json.vim b/syntax_checkers/json.vim index 2d2652db..1c2b3c99 100644 --- a/syntax_checkers/json.vim +++ b/syntax_checkers/json.vim @@ -20,4 +20,4 @@ endif let loaded_json_syntax_checker = 1 let s:supported_checkers = ["jsonlint", "jsonval"] -call SyntasticLoadChecker(s:supported_checkers) +call SyntasticLoadChecker(s:supported_checkers, 'json') diff --git a/syntax_checkers/python.vim b/syntax_checkers/python.vim index 93a0b529..863e0642 100644 --- a/syntax_checkers/python.vim +++ b/syntax_checkers/python.vim @@ -24,4 +24,4 @@ if !exists('g:syntastic_python_checker_args') endif let s:supported_checkers = ["flake8", "pyflakes", "pylint"] -call SyntasticLoadChecker(s:supported_checkers) +call SyntasticLoadChecker(s:supported_checkers, 'python')