make.vim 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. "============================================================================
  2. "File: make.vim
  3. "Description: Syntax checking plugin for syntastic.vim
  4. "Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
  5. "License: This program is free software. It comes without any warranty,
  6. " to the extent permitted by applicable law. You can redistribute
  7. " it and/or modify it under the terms of the Do What The Fuck You
  8. " Want To Public License, Version 2, as published by Sam Hocevar.
  9. " See http://sam.zoy.org/wtfpl/COPYING for more details.
  10. "
  11. "============================================================================
  12. if exists('g:loaded_syntastic_c_make_checker')
  13. finish
  14. endif
  15. let g:loaded_syntastic_c_make_checker = 1
  16. let s:save_cpo = &cpo
  17. set cpo&vim
  18. function! SyntaxCheckers_c_make_GetLocList() dict
  19. let makeprg = self.makeprgBuild({ 'args': '-sk', 'fname': '' })
  20. let errorformat =
  21. \ '%-G%f:%s:,' .
  22. \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
  23. \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
  24. \ '%-GIn file included%.%#,' .
  25. \ '%-G %#from %f:%l\,,' .
  26. \ '%f:%l:%c: %trror: %m,' .
  27. \ '%f:%l:%c: %tarning: %m,' .
  28. \ '%f:%l:%c: %m,' .
  29. \ '%f:%l: %trror: %m,' .
  30. \ '%f:%l: %tarning: %m,'.
  31. \ '%f:%l: %m'
  32. if exists('g:syntastic_c_errorformat')
  33. let errorformat = g:syntastic_c_errorformat
  34. endif
  35. " process makeprg
  36. let errors = SyntasticMake({
  37. \ 'makeprg': makeprg,
  38. \ 'errorformat': errorformat })
  39. " filter the processed errors if desired
  40. if exists('g:syntastic_c_remove_include_errors') && g:syntastic_c_remove_include_errors != 0
  41. return filter(errors, 'has_key(v:val, "bufnr") && v:val["bufnr"] == ' . bufnr(''))
  42. else
  43. return errors
  44. endif
  45. endfunction
  46. call g:SyntasticRegistry.CreateAndRegisterChecker({
  47. \ 'filetype': 'c',
  48. \ 'name': 'make'})
  49. let &cpo = s:save_cpo
  50. unlet s:save_cpo
  51. " vim: set sw=4 sts=4 et fdm=marker: