From b639b007ae98bbc658261484fe4ab07677fe1c0f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 21 Sep 2014 19:24:22 +0300 Subject: [PATCH] New options. Add options b:syntastic___exec and b:syntastic__exec. --- doc/syntastic.txt | 23 ++++++++++++++++------- plugin/syntastic.vim | 2 +- plugin/syntastic/checker.vim | 8 +++----- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 6e770520..8f09e818 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -616,11 +616,19 @@ Use |:SyntasticInfo| to see which checkers are available for a given filetype. 5.2 Choosing the executable *syntastic-config-exec* *'syntastic___exec'* -The executable used by a checker is normally defined automatically, when the -checkers is registered. You can however override it by setting the variable +The executable run by a checker is normally defined automatically, when the +checker is registered. You can however override it, by setting the variable 'g:syntastic___exec': > let g:syntastic_ruby_mri_exec = '~/bin/ruby2' < +This variable has a local version, 'b:syntastic___exec', +which takes precedence over the global one in the corresponding buffer. + + *'b:syntastic__exec'* +And there is also a local variable named 'b:syntastic__exec', which +takes precedence over both 'b:syntastic___exec' and +'g:syntastic___exec' in the buffers where it is defined. + ------------------------------------------------------------------------------ 5.3 Configuring specific checkers *syntastic-config-makeprg* @@ -651,13 +659,14 @@ you can set it to an empty string, e.g.: > *'syntastic___exe'* The 'exe' is normally the same as the 'exec' attribute described above, in which case it may be omitted. However, you can use it to add environment -variables or additional parameters, e.g. to tell the mri checker to use KANJI -encoding you could do something like this: > - let g:syntastic_ruby_mri_exe = 'RUBYOPT="-Ke" ruby' +variables, or to change the way the checker is run. For example this setup +allows you to run PC-Lint under Wine emulation on Linux: > + let g:syntastic_c_pc_lint_exec = "wine" + let g:syntastic_c_pc_lint_exe = "wine c:/path/to/lint-nt.exe" < To override the args and the tail: > - let g:syntastic_ruby_mri_args = "--my --args --here" - let g:syntastic_ruby_mri_tail = "> /tmp/my-output-file-biatch" + let g:syntastic_c_pc_lint_args = "-w5 -Iz:/usr/include/linux" + let g:syntastic_c_pc_lint_tail = "2>/dev/null" < The general form of the override options is: > syntastic___ diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 7152032e..394fb692 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.5.0-28' +let g:syntastic_version = '3.5.0-29' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 7ae4ad7b..37605413 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -46,11 +46,9 @@ function! g:SyntasticChecker.getName() " {{{2 endfunction " }}}2 function! g:SyntasticChecker.getExec() " {{{2 - if exists('g:syntastic_' . self._filetype . '_' . self._name . '_exec') - return expand(g:syntastic_{self._filetype}_{self._name}_exec) - endif - - return self._exec + return + \ exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec : + \ expand(syntastic#util#var(self._filetype . '_' . self._name . '_exec', self._exec)) endfunction " }}}2 function! g:SyntasticChecker.getExecEscaped() " {{{2