avrgcc.vim 2.0 KB

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