avrgcc.vim 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "============================================================================
  2. "File: avrgcc.vim
  3. "Description: Syntax checking plugin for syntastic
  4. "Maintainer: Karel <karelishere 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_avrgcc_checker')
  13. finish
  14. endif
  15. let g:loaded_syntastic_c_avrgcc_checker = 1
  16. let s:save_cpo = &cpo
  17. set cpo&vim
  18. let s:opt_x = { 'c': 'c', 'cpp': 'c++' }
  19. function! SyntaxCheckers_c_avrgcc_GetLocList() dict
  20. let buf = bufnr('')
  21. let makeprg = self.makeprgBuild({
  22. \ 'args_before': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'avrgcc_config_file')),
  23. \ 'args_after': '-x ' . get(s:opt_x, self.getFiletype(), '') . ' -fsyntax-only' })
  24. let errorformat =
  25. \ '%-G%f:%s:,' .
  26. \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
  27. \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
  28. \ '%-GIn file included%.%#,' .
  29. \ '%-G %#from %f:%l\,,' .
  30. \ '%f:%l:%c: %trror: %m,' .
  31. \ '%f:%l:%c: %tarning: %m,' .
  32. \ '%f:%l:%c: %m,' .
  33. \ '%f:%l: %trror: %m,' .
  34. \ '%f:%l: %tarning: %m,'.
  35. \ '%f:%l: %m'
  36. return SyntasticMake({
  37. \ 'makeprg': makeprg,
  38. \ 'errorformat': errorformat,
  39. \ 'postprocess': ['compressWhitespace'] })
  40. endfunction
  41. call g:SyntasticRegistry.CreateAndRegisterChecker({
  42. \ 'filetype': 'c',
  43. \ 'name': 'avrgcc',
  44. \ 'exec': 'avr-gcc'})
  45. let &cpo = s:save_cpo
  46. unlet s:save_cpo
  47. " vim: set sw=4 sts=4 et fdm=marker: