sparse.vim 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "============================================================================
  2. "File: sparse.vim
  3. "Description: Syntax checking plugin for syntastic.vim using sparse.pl
  4. "Maintainer: Daniel Walker <dwalker at fifo99 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. if exists('g:loaded_syntastic_c_sparse_checker')
  12. finish
  13. endif
  14. let g:loaded_syntastic_c_sparse_checker = 1
  15. if !exists('g:syntastic_sparse_config_file')
  16. let g:syntastic_sparse_config_file = '.syntastic_sparse_config'
  17. endif
  18. let s:save_cpo = &cpo
  19. set cpo&vim
  20. function! SyntaxCheckers_c_sparse_GetLocList() dict
  21. let makeprg = self.makeprgBuild({
  22. \ 'args': syntastic#c#ReadConfig(g:syntastic_sparse_config_file),
  23. \ 'args_after': '-ftabstop=' . &ts })
  24. let errorformat =
  25. \ '%f:%l:%v: %trror: %m,' .
  26. \ '%f:%l:%v: %tarning: %m,'
  27. let loclist = SyntasticMake({
  28. \ 'makeprg': makeprg,
  29. \ 'errorformat': errorformat,
  30. \ 'defaults': {'bufnr': bufnr('')},
  31. \ 'returns': [0, 1] })
  32. return loclist
  33. endfunction
  34. call g:SyntasticRegistry.CreateAndRegisterChecker({
  35. \ 'filetype': 'c',
  36. \ 'name': 'sparse'})
  37. let &cpo = s:save_cpo
  38. unlet s:save_cpo
  39. " vim: set sw=4 sts=4 et fdm=marker: