Skip to content

Instantly share code, notes, and snippets.

@scrooloose
Created February 4, 2013 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scrooloose/4707685 to your computer and use it in GitHub Desktop.
Save scrooloose/4707685 to your computer and use it in GitHub Desktop.
"stick this in syntax_checkers/c/make.vim
"use let g:syntastic_c_checker="make" to activate it
function! SyntaxCheckers_c_make_IsAvailable()
return executable('make')
endfunction
function! SyntaxCheckers_c_make_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'make',
\ 'args': '-sk',
\ 'subchecker': 'make' })
let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '.
\ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '.
\ 'each function it appears%.%#,%-GIn file included%.%#,'.
\ '%-G %#from %f:%l\,,%f:%l:%c: %trror: %m,%f:%l:%c: '.
\ '%tarning: %m,%f:%l:%c: %m,%f:%l: %trror: %m,'.
\ '%f:%l: %tarning: %m,%f:%l: %m'
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_c_remove_include_errors') &&
\ g:syntastic_c_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'make'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment