Merge remote-tracking branch 'origin/modemap_ignore'

This commit is contained in:
Martin Grenfell 2013-05-17 15:58:07 +01:00
commit 86fdb12540
2 changed files with 28 additions and 1 deletions

View File

@ -254,6 +254,15 @@ opens. >
let g:syntastic_loc_list_height=5
<
*'syntastic_ignore_files'*
Default: []
Use this option to specify files that syntastic should neither check, nor
include in error lists. It has to be a list of |regular-expression| patterns.
The full paths of files (see |::p|) are matched against these patterns, and
the matches are case sensitive. Use |\c| if you need case insensitive
patterns. >
let g:syntastic_ignore_files=['^/usr/include/', '\c\.h$']
<
*'syntastic_mode_map'*
Default: { "mode": "active",

View File

@ -48,6 +48,10 @@ if !exists("g:syntastic_loc_list_height")
let g:syntastic_loc_list_height = 10
endif
if !exists("g:syntastic_ignore_files")
let g:syntastic_ignore_files = []
endif
let s:registry = g:SyntasticRegistry.Instance()
let s:notifiers = g:SyntasticNotifiers.New()
let s:modemap = g:SyntasticModeMap.Instance()
@ -222,10 +226,21 @@ function! s:Redraw()
endif
endfunction
function! s:IgnoreFile(filename)
let fname = fnamemodify(a:filename, ':p')
for p in g:syntastic_ignore_files
if fname =~# p
return 1
endif
endfor
return 0
endfunction
" Skip running in special buffers
function! s:SkipFile()
let force_skip = exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0
return force_skip || !empty(&buftype) || !filereadable(expand('%')) || getwinvar(0, '&diff')
let fname = expand('%')
return force_skip || !empty(&buftype) || !filereadable(fname) || getwinvar(0, '&diff') || s:IgnoreFile(fname)
endfunction
function! s:uname()
@ -338,6 +353,9 @@ function! SyntasticMake(options)
call SyntasticAddToErrors(errors, a:options['defaults'])
endif
" Apply ignore patterns
call filter(errors, '!s:IgnoreFile(bufname(str2nr(v:val["bufnr"])))')
" Add subtype info if present.
if has_key(a:options, 'subtype')
call SyntasticAddToErrors(errors, {'subtype': a:options['subtype']})