avrgcc.vim 1.9 KB

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