pc_lint.vim 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. "============================================================================
  2. "File: pc_lint.vim
  3. "Description: Syntax checking plugin for syntastic.vim
  4. "Maintainer: Steve Bragg <steve at empresseffects 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_pc_lint_checker')
  13. finish
  14. endif
  15. let g:loaded_syntastic_c_pc_lint_checker = 1
  16. let s:save_cpo = &cpo
  17. set cpo&vim
  18. if !exists('g:syntastic_pc_lint_config_file')
  19. let g:syntastic_pc_lint_config_file = 'options.lnt'
  20. endif
  21. function! SyntaxCheckers_c_pc_lint_GetLocList() dict
  22. let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, expand('%:p:h', 1))
  23. call self.log('config =', config)
  24. " -hFs1 - show filename, add space after messages, try to make message 1 line
  25. " -width(0,0) - make sure there are no line breaks
  26. " -t - set tab size
  27. " -v - turn off verbosity
  28. let makeprg = self.makeprgBuild({
  29. \ 'args': (filereadable(config) ? syntastic#util#shescape(fnamemodify(config, ':p')) : ''),
  30. \ 'args_after': ['-hFs1', '-width(0,0)', '-t' . &tabstop, '-format=%f:%l:%C:%t:%n:%m'] })
  31. let errorformat =
  32. \ '%E%f:%l:%v:Error:%n:%m,' .
  33. \ '%W%f:%l:%v:Warning:%n:%m,' .
  34. \ '%I%f:%l:%v:Info:%n:%m,' .
  35. \ '%-G%.%#'
  36. let loclist = SyntasticMake({
  37. \ 'makeprg': makeprg,
  38. \ 'errorformat': errorformat,
  39. \ 'postprocess': ['cygwinRemoveCR'] })
  40. for e in loclist
  41. if e['type'] ==? 'I'
  42. let e['type'] = 'W'
  43. let e['subtype'] = 'Style'
  44. endif
  45. endfor
  46. return loclist
  47. endfunction
  48. call g:SyntasticRegistry.CreateAndRegisterChecker({
  49. \ 'filetype': 'c',
  50. \ 'name': 'pc_lint',
  51. \ 'exec': 'lint-nt'})
  52. let &cpo = s:save_cpo
  53. unlet s:save_cpo
  54. " vim: set sw=4 sts=4 et fdm=marker: