1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
|
Index: vim-syntastic-3.7.0/autoload/syntastic/c.vim
===================================================================
--- vim-syntastic-3.7.0.orig/autoload/syntastic/c.vim
+++ vim-syntastic-3.7.0/autoload/syntastic/c.vim
@@ -228,7 +228,7 @@ function! s:_get_cflags(ft, ck, opts) ab
endif
" add optional config file parameters
- let config_file = s:_get_checker_var('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
+ let config_file = s:_get_checker_var('b', a:ft, a:ck, 'config_file', s:_get_checker_var('g', a:ft, a:ck, 'config_file', ''))
let flags .= ' ' . syntastic#c#ReadConfig(config_file)
if b_cflags ==# '' && (a:ft ==# 'c' || a:ft ==# 'cpp') && !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0)
Index: vim-syntastic-3.7.0/syntax_checkers/c/avrgcc.vim
===================================================================
--- vim-syntastic-3.7.0.orig/syntax_checkers/c/avrgcc.vim
+++ vim-syntastic-3.7.0/syntax_checkers/c/avrgcc.vim
@@ -15,16 +15,14 @@ if exists('g:loaded_syntastic_c_avrgcc_c
endif
let g:loaded_syntastic_c_avrgcc_checker = 1
-if !exists('g:syntastic_avrgcc_config_file')
- let g:syntastic_avrgcc_config_file = '.syntastic_avrgcc_config'
-endif
-
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_avrgcc_GetLocList() dict
+ let buf = bufnr('')
+
let makeprg = self.makeprgBuild({
- \ 'args_before': syntastic#c#ReadConfig(g:syntastic_avrgcc_config_file),
+ \ 'args_before': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'avrgcc_config_file')),
\ 'args_after': '-x c -fsyntax-only' })
let errorformat =
Index: vim-syntastic-3.7.0/syntax_checkers/c/clang_check.vim
===================================================================
--- vim-syntastic-3.7.0.orig/syntax_checkers/c/clang_check.vim
+++ vim-syntastic-3.7.0/syntax_checkers/c/clang_check.vim
@@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_c_clang_ch
endif
let g:loaded_syntastic_c_clang_check_checker = 1
-if !exists('g:syntastic_clang_check_config_file')
- let g:syntastic_clang_check_config_file = '.syntastic_clang_check_config'
-endif
-
if !exists('g:syntastic_c_clang_check_sort')
let g:syntastic_c_clang_check_sort = 1
endif
@@ -26,10 +22,12 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_clang_check_GetLocList() dict
+ let buf = bufnr('')
+
let makeprg = self.makeprgBuild({
\ 'post_args':
\ '-- ' .
- \ syntastic#c#ReadConfig(g:syntastic_clang_check_config_file) . ' ' .
+ \ syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'clang_check_config_file')) . ' ' .
\ '-fshow-column ' .
\ '-fshow-source-location ' .
\ '-fno-caret-diagnostics ' .
Index: vim-syntastic-3.7.0/syntax_checkers/c/clang_tidy.vim
===================================================================
--- vim-syntastic-3.7.0.orig/syntax_checkers/c/clang_tidy.vim
+++ vim-syntastic-3.7.0/syntax_checkers/c/clang_tidy.vim
@@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_c_clang_ti
endif
let g:loaded_syntastic_c_clang_tidy_checker = 1
-if !exists('g:syntastic_clang_tidy_config_file')
- let g:syntastic_clang_tidy_config_file = '.syntastic_clang_tidy_config'
-endif
-
if !exists('g:syntastic_c_clang_tidy_sort')
let g:syntastic_c_clang_tidy_sort = 1
endif
@@ -26,10 +22,12 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_clang_tidy_GetLocList() dict
+ let buf = bufnr('')
+
let makeprg = self.makeprgBuild({
\ 'post_args':
\ '-- ' .
- \ syntastic#c#ReadConfig(g:syntastic_clang_tidy_config_file) . ' ' .
+ \ syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'clang_tidy_config_file')) . ' ' .
\ '-fshow-column ' .
\ '-fshow-source-location ' .
\ '-fno-caret-diagnostics ' .
Index: vim-syntastic-3.7.0/syntax_checkers/c/cppcheck.vim
===================================================================
--- vim-syntastic-3.7.0.orig/syntax_checkers/c/cppcheck.vim
+++ vim-syntastic-3.7.0/syntax_checkers/c/cppcheck.vim
@@ -14,16 +14,14 @@ if exists('g:loaded_syntastic_c_cppcheck
endif
let g:loaded_syntastic_c_cppcheck_checker = 1
-if !exists('g:syntastic_cppcheck_config_file')
- let g:syntastic_cppcheck_config_file = '.syntastic_cppcheck_config'
-endif
-
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_cppcheck_GetLocList() dict
+ let buf = bufnr('')
+
let makeprg = self.makeprgBuild({
- \ 'args': syntastic#c#ReadConfig(g:syntastic_cppcheck_config_file),
+ \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'cppcheck_config_file')),
\ 'args_after': '-q --enable=style' })
let errorformat =
Index: vim-syntastic-3.7.0/syntax_checkers/c/oclint.vim
===================================================================
--- vim-syntastic-3.7.0.orig/syntax_checkers/c/oclint.vim
+++ vim-syntastic-3.7.0/syntax_checkers/c/oclint.vim
@@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_c_oclint_c
endif
let g:loaded_syntastic_c_oclint_checker = 1
-if !exists('g:syntastic_oclint_config_file')
- let g:syntastic_oclint_config_file = '.syntastic_oclint_config'
-endif
-
if !exists('g:syntastic_c_oclint_sort')
let g:syntastic_c_oclint_sort = 1
endif
@@ -26,8 +22,10 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_oclint_GetLocList() dict
+ let buf = bufnr('')
+
let makeprg = self.makeprgBuild({
- \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) })
+ \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'oclint_config_file') })
let errorformat =
\ '%E%f:%l:%c: fatal error: %m,' .
Index: vim-syntastic-3.7.0/syntax_checkers/c/pc_lint.vim
===================================================================
--- vim-syntastic-3.7.0.orig/syntax_checkers/c/pc_lint.vim
+++ vim-syntastic-3.7.0/syntax_checkers/c/pc_lint.vim
@@ -18,12 +18,9 @@ let g:loaded_syntastic_c_pc_lint_checker
let s:save_cpo = &cpo
set cpo&vim
-if !exists('g:syntastic_pc_lint_config_file')
- let g:syntastic_pc_lint_config_file = 'options.lnt'
-endif
-
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
- let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, expand('%:p:h', 1))
+ let buf = bufnr('')
+ let config = syntastic#util#findFileInParent(syntastic#util#bufVar(buf, 'pc_lint_config_file'), fnamemodify(bufname(buf), ':p:h'))
call self.log('config =', config)
" -hFs1 - show filename, add space after messages, try to make message 1 line
Index: vim-syntastic-3.7.0/syntax_checkers/c/sparse.vim
===================================================================
--- vim-syntastic-3.7.0.orig/syntax_checkers/c/sparse.vim
+++ vim-syntastic-3.7.0/syntax_checkers/c/sparse.vim
@@ -14,16 +14,14 @@ if exists('g:loaded_syntastic_c_sparse_c
endif
let g:loaded_syntastic_c_sparse_checker = 1
-if !exists('g:syntastic_sparse_config_file')
- let g:syntastic_sparse_config_file = '.syntastic_sparse_config'
-endif
-
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_sparse_GetLocList() dict
+ let buf = bufnr('')
+
let makeprg = self.makeprgBuild({
- \ 'args': syntastic#c#ReadConfig(g:syntastic_sparse_config_file),
+ \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'sparse_config_file')),
\ 'args_after': '-ftabstop=' . &ts })
let errorformat =
Index: vim-syntastic-3.7.0/syntax_checkers/c/splint.vim
===================================================================
--- vim-syntastic-3.7.0.orig/syntax_checkers/c/splint.vim
+++ vim-syntastic-3.7.0/syntax_checkers/c/splint.vim
@@ -14,16 +14,14 @@ if exists('g:loaded_syntastic_c_splint_c
endif
let g:loaded_syntastic_c_splint_checker = 1
-if !exists('g:syntastic_splint_config_file')
- let g:syntastic_splint_config_file = '.syntastic_splint_config'
-endif
-
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_splint_GetLocList() dict
+ let buf = bufnr('')
+
let makeprg = self.makeprgBuild({
- \ 'args': syntastic#c#ReadConfig(g:syntastic_splint_config_file),
+ \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'splint_config_file')),
\ 'args_after': '-showfunc -hints +quiet' })
let errorformat =
Index: vim-syntastic-3.7.0/syntax_checkers/cpp/verapp.vim
===================================================================
--- vim-syntastic-3.7.0.orig/syntax_checkers/cpp/verapp.vim
+++ vim-syntastic-3.7.0/syntax_checkers/cpp/verapp.vim
@@ -16,16 +16,14 @@ if exists('g:loaded_syntastic_cpp_verapp
endif
let g:loaded_syntastic_cpp_verapp_checker = 1
-if !exists('g:syntastic_verapp_config_file')
- let g:syntastic_verapp_config_file = '.syntastic_verapp_config'
-endif
-
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cpp_verapp_GetLocList() dict
+ let buf = bufnr('')
+
let makeprg = self.makeprgBuild({
- \ 'args': syntastic#c#ReadConfig(g:syntastic_verapp_config_file),
+ \ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'verapp_config_file')),
\ 'args_after': '--show-rule --no-duplicate -S -c -' })
let errorformat = '%f:%t:%l:%c:%m'
Index: vim-syntastic-3.7.0/autoload/syntastic/util.vim
===================================================================
--- vim-syntastic-3.7.0.orig/autoload/syntastic/util.vim
+++ vim-syntastic-3.7.0/autoload/syntastic/util.vim
@@ -107,6 +107,10 @@ function! syntastic#util#rmrf(what) abor
endif
endfunction " }}}2
+function! syntastic#util#getbufvar(buf, name, ...) abort " {{{2
+ return a:0 ? s:_getbufvar(a:buf, a:name, a:1) : getbufvar(a:buf, a:name)
+endfunction " }}}2
+
" Search the first 5 lines of the file for a magic number and return a map
" containing the args and the executable
"
@@ -131,12 +135,24 @@ function! syntastic#util#parseShebang()
return { 'exe': '', 'args': [] }
endfunction " }}}2
-" Get the value of a variable. Allow local variables to override global ones.
+" Get the value of a Vim variable. Allow buffer variables to override global ones.
+function! syntastic#util#bufRawVar(buf, name, ...) abort " {{{2
+ return s:_getbufvar(a:buf, a:name, get(g:, a:name, a:0 ? a:1 : ''))
+endfunction "}}}2
+
+" Get the value of a syntastic variable. Allow buffer variables to override global ones.
+function! syntastic#util#bufVar(buf, name, ...) abort " {{{2
+ return call('syntastic#util#bufRawVar', [a:buf, 'syntastic_' . a:name] + a:000)
+endfunction "}}}2
+
+" Get the value of a Vim variable. Allow local variables to override global ones.
+function! syntastic#util#rawVar(name, ...) abort " {{{2
+ return get(b:, a:name, get(g:, a:name, a:0 ? a:1 : ''))
+endfunction " }}}2
+
+" Get the value of a syntastic variable. Allow local variables to override global ones.
function! syntastic#util#var(name, ...) abort " {{{2
- return
- \ exists('b:syntastic_' . a:name) ? b:syntastic_{a:name} :
- \ exists('g:syntastic_' . a:name) ? g:syntastic_{a:name} :
- \ a:0 > 0 ? a:1 : ''
+ return call('syntastic#util#rawVar', ['syntastic_' . a:name] + a:000)
endfunction " }}}2
" Parse a version string. Return an array of version components.
@@ -486,6 +502,18 @@ function! s:_float2str_smart(val) abort
return printf('%.1f', a:val)
endfunction " }}}2
+function! s:_getbufvar_dumb(buf, name, ...) abort " {{{2
+ let ret = getbufvar(a:buf, a:name)
+ if a:0 && type(ret) == type('') && ret ==# ''
+ unlet! ret
+ let ret = a:1
+ endif
+ return ret
+endfunction "}}}2
+
+let s:_getbufvar = function(v:version > 703 || (v:version == 703 && has('patch831')) ? 'getbufvar' : 's:_getbufvar_dumb')
+lockvar s:_getbufvar
+
function! s:_float2str_dumb(val) abort " {{{2
return a:val
endfunction " }}}2
|