diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 1c6bc522..82f4c704 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -67,7 +67,8 @@ function! syntastic#c#GetLocList(filetype, subchecker, options) return [] endtry - let makeprg = expand(g:syntastic_{a:filetype}_compiler) . ' ' . flags . ' ' . syntastic#util#shexpand('%') + let makeprg = syntastic#util#shexpand(g:syntastic_{a:filetype}_compiler) . + \ ' ' . flags . ' ' . syntastic#util#shexpand('%') let errorformat = s:GetCheckerVar('g', a:filetype, a:subchecker, 'errorformat', a:options['errorformat']) diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index 9a8848f4..4fd19847 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -15,10 +15,6 @@ if exists('g:loaded_syntastic_c_gcc_checker') endif let g:loaded_syntastic_c_gcc_checker = 1 -if !exists('g:syntastic_c_compiler') - let g:syntastic_c_compiler = executable('gcc') ? 'gcc' : 'clang' -endif - if !exists('g:syntastic_c_compiler_options') let g:syntastic_c_compiler_options = '-std=gnu99' endif @@ -27,6 +23,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_gcc_IsAvailable() dict + if !exists('g:syntastic_c_compiler') + let g:syntastic_c_compiler = executable(self.getExec()) ? self.getExec() : 'clang' + endif return executable(expand(g:syntastic_c_compiler)) endfunction diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index ef810517..c8d77996 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -15,10 +15,6 @@ if exists('g:loaded_syntastic_cpp_gcc_checker') endif let g:loaded_syntastic_cpp_gcc_checker = 1 -if !exists('g:syntastic_cpp_compiler') - let g:syntastic_cpp_compiler = executable('g++') ? 'g++' : 'clang++' -endif - if !exists('g:syntastic_cpp_compiler_options') let g:syntastic_cpp_compiler_options = '' endif @@ -27,6 +23,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_cpp_gcc_IsAvailable() dict + if !exists('g:syntastic_cpp_compiler') + let g:syntastic_cpp_compiler = executable(self.getExec()) ? self.getExec() : 'clang++' + endif return executable(expand(g:syntastic_cpp_compiler)) endfunction @@ -47,7 +46,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', - \ 'name': 'gcc' }) + \ 'name': 'gcc', + \ 'exec': 'g++' }) let &cpo = s:save_cpo unlet s:save_cpo diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 94ba42e6..34dc9bdc 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -15,19 +15,18 @@ if exists("g:loaded_syntastic_eruby_ruby_checker") endif let g:loaded_syntastic_eruby_ruby_checker = 1 -if !exists("g:syntastic_ruby_exec") - let g:syntastic_ruby_exec = "ruby" -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_eruby_ruby_IsAvailable() dict + if !exists("g:syntastic_ruby_exec") + let g:syntastic_ruby_exec = self.getExec() + endif return executable(expand(g:syntastic_ruby_exec)) endfunction function! SyntaxCheckers_eruby_ruby_GetLocList() dict - let exe = expand(g:syntastic_ruby_exec) + let exe = syntastic#util#shexpand(g:syntastic_ruby_exec) if !syntastic#util#isRunningWindows() let exe = 'RUBYOPT= ' . exe endif @@ -35,7 +34,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict let fname = "'" . escape(expand('%'), "\\'") . "'" " TODO: encodings became useful in ruby 1.9 :) - if syntastic#util#versionIsAtLeast(syntastic#util#getVersion('ruby --version'), [1, 9]) + if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version'), [1, 9]) let enc = &fileencoding != '' ? &fileencoding : &encoding let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"' else diff --git a/syntax_checkers/haml/haml.vim b/syntax_checkers/haml/haml.vim index fa7086f9..b01143e9 100644 --- a/syntax_checkers/haml/haml.vim +++ b/syntax_checkers/haml/haml.vim @@ -15,20 +15,19 @@ if exists('g:loaded_syntastic_haml_haml_checker') endif let g:loaded_syntastic_haml_haml_checker = 1 -if !exists('g:syntastic_haml_interpreter') - let g:syntastic_haml_interpreter = 'haml' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_haml_haml_IsAvailable() dict + if !exists('g:syntastic_haml_interpreter') + let g:syntastic_haml_interpreter = self.getExec() + endif return executable(expand(g:syntastic_haml_interpreter)) endfunction function! SyntaxCheckers_haml_haml_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'exe': expand(g:syntastic_haml_interpreter), + \ 'exe': syntastic#util#shexpand(g:syntastic_haml_interpreter), \ 'args_after': '-c' }) let errorformat = diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index 48a42f8b..7bdd0ebd 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -226,7 +226,7 @@ function! s:GetMavenProperties() let pom = findfile("pom.xml", ".;") if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_properties, pom) - let mvn_cmd = expand(g:syntastic_java_maven_executable) . ' -f ' . pom + let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom let mvn_is_managed_tag = 1 let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n") let current_path = 'project' @@ -265,7 +265,7 @@ function! s:GetMavenClasspath() let pom = findfile("pom.xml", ".;") if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom) - let mvn_cmd = expand(g:syntastic_java_maven_executable) . ' -f ' . pom + let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") let mvn_classpath = '' let class_path_next = 0 diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index e57329e5..e1c84f14 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_javascript_jshint_checker') endif let g:loaded_syntastic_javascript_jshint_checker = 1 -if !exists('g:syntastic_jshint_exec') - let g:syntastic_jshint_exec = 'jshint' -endif - if !exists('g:syntastic_javascript_jshint_conf') let g:syntastic_javascript_jshint_conf = '' endif @@ -26,17 +22,21 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_jshint_IsAvailable() dict + if !exists('g:syntastic_jshint_exec') + let g:syntastic_jshint_exec = self.getExec() + endif return executable(expand(g:syntastic_jshint_exec)) endfunction function! SyntaxCheckers_javascript_jshint_GetLocList() dict + let exe = syntastic#util#shexpand(g:syntastic_jshint_exec) if !exists('s:jshint_new') let s:jshint_new = - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(expand(g:syntastic_jshint_exec) . ' --version'), [1, 1]) + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version'), [1, 1]) endif let makeprg = self.makeprgBuild({ - \ 'exe': expand(g:syntastic_jshint_exec), + \ 'exe': exe, \ 'args': (g:syntastic_javascript_jshint_conf != '' ? '--config ' . g:syntastic_javascript_jshint_conf : ''), \ 'args_after': (s:jshint_new ? '--verbose ' : '') }) diff --git a/syntax_checkers/less/lessc.vim b/syntax_checkers/less/lessc.vim index 853524eb..9b5efa96 100644 --- a/syntax_checkers/less/lessc.vim +++ b/syntax_checkers/less/lessc.vim @@ -33,17 +33,17 @@ endif let s:save_cpo = &cpo set cpo&vim -if g:syntastic_less_use_less_lint - let s:check_file = 'node ' . syntastic#util#shescape(expand(':p:h') . syntastic#util#Slash() . 'less-lint.js') -else - let s:check_file = 'lessc' -endif +let s:node_file = 'node ' . syntastic#util#shescape(expand(':p:h') . syntastic#util#Slash() . 'less-lint.js') function! SyntaxCheckers_less_lessc_IsAvailable() dict - return g:syntastic_less_use_less_lint ? executable('node') : executable('lessc') + return g:syntastic_less_use_less_lint ? executable('node') : executable(self.getExec()) endfunction function! SyntaxCheckers_less_lessc_GetLocList() dict + if !exists('s:check_file') + let s:check_file = g:syntastic_less_use_less_lint ? s:node_file : self.getExecEscaped() + endif + let makeprg = self.makeprgBuild({ \ 'exe': s:check_file, \ 'args': g:syntastic_less_options, diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index d5241592..09c3daa2 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -15,10 +15,6 @@ if exists('g:loaded_syntastic_objc_gcc_checker') endif let g:loaded_syntastic_objc_gcc_checker = 1 -if !exists('g:syntastic_objc_compiler') - let g:syntastic_objc_compiler = executable('gcc') ? 'gcc' : 'clang' -endif - if !exists('g:syntastic_objc_compiler_options') let g:syntastic_objc_compiler_options = '-std=gnu99' endif @@ -27,6 +23,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_objc_gcc_IsAvailable() dict + if !exists('g:syntastic_objc_compiler') + let g:syntastic_objc_compiler = executable(self.getExec()) ? self.getExec() : 'clang' + endif return executable(expand(g:syntastic_objc_compiler)) endfunction diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index 55ae5014..853d6657 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -15,10 +15,6 @@ if exists('g:loaded_syntastic_objcpp_gcc_checker') endif let g:loaded_syntastic_objcpp_gcc_checker = 1 -if !exists('g:syntastic_objcpp_compiler') - let g:syntastic_objcpp_compiler = executable('gcc') ? 'gcc' : 'clang' -endif - if !exists('g:syntastic_objcpp_compiler_options') let g:syntastic_objcpp_compiler_options = '-std=gnu99' endif @@ -27,6 +23,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_objcpp_gcc_IsAvailable() dict + if !exists('g:syntastic_c_compiler') + let g:syntastic_objcpp_compiler = executable(self.getExec()) ? self.getExec() : 'clang' + endif return executable(expand(g:syntastic_objcpp_compiler)) endfunction diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 425a90f3..2a32a8fa 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -26,9 +26,9 @@ endif function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict return \ executable("puppet") && - \ executable("puppet-lint") && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('puppet-lint --version 2>' . - \ syntastic#util#DevNull()), [0,1,10]) + \ executable(self.getExec()) && + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion( + \ self.getExecEscaped() . ' --version 2>' . syntastic#util#DevNull()), [0,1,10]) endfunction function! SyntaxCheckers_puppet_puppetlint_GetLocList() dict diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index bdc74ea0..c0b0166d 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -15,10 +15,6 @@ if exists("g:loaded_syntastic_ruby_mri_checker") endif let g:loaded_syntastic_ruby_mri_checker = 1 -if !exists("g:syntastic_ruby_exec") - let g:syntastic_ruby_exec = "ruby" -endif - let s:save_cpo = &cpo set cpo&vim @@ -32,7 +28,11 @@ function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) endfunction function! SyntaxCheckers_ruby_mri_GetLocList() dict - let exe = expand(g:syntastic_ruby_exec) + if !exists('g:syntastic_ruby_exec') + let g:syntastic_ruby_exec = self.getExec() + endif + + let exe = syntastic#util#shexpand(g:syntastic_ruby_exec) if !syntastic#util#isRunningWindows() let exe = 'RUBYOPT= ' . exe endif diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 1c3d2b17..8cc2bfc0 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -18,17 +18,15 @@ let g:loaded_syntastic_slim_slimrb_checker = 1 let s:save_cpo = &cpo set cpo&vim -function! s:SlimrbVersion() - if !exists('s:slimrb_version') - let s:slimrb_version = syntastic#util#getVersion('slimrb --version 2>' . syntastic#util#DevNull()) - endif - return s:slimrb_version -endfunction - function! SyntaxCheckers_slim_slimrb_GetLocList() dict + if !exists('s:slimrb_new') + let s:slimrb_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( + \ self.getExecEscaped() . ' --version 2>'. syntastic#util#DevNull()), [1, 3, 1]) + endif + let makeprg = self.makeprgBuild({ 'args_after': '-c' }) - if syntastic#util#versionIsAtLeast(s:SlimrbVersion(), [1,3,1]) + if s:slimrb_new let errorformat = \ '%C\ %#%f\, Line %l\, Column %c,'. \ '%-G\ %.%#,'. diff --git a/syntax_checkers/yaml/yamlxs.vim b/syntax_checkers/yaml/yamlxs.vim index ec254a32..20665335 100644 --- a/syntax_checkers/yaml/yamlxs.vim +++ b/syntax_checkers/yaml/yamlxs.vim @@ -16,10 +16,6 @@ if exists("g:loaded_syntastic_yaml_yamlxs_checker") endif let g:loaded_syntastic_yaml_yamlxs_checker = 1 -if !exists('g:syntastic_perl_interpreter') - let g:syntastic_perl_interpreter = 'perl' -endif - if !exists('g:syntastic_perl_lib_path') let g:syntastic_perl_lib_path = [] endif @@ -28,6 +24,10 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict + if !exists('g:syntastic_perl_interpreter') + let g:syntastic_perl_interpreter = self.getExec() + endif + " don't call executable() here, to allow things like " let g:syntastic_perl_interpreter='/usr/bin/env perl' silent! call system(s:Exe() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)'))