xmllint.vim 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "============================================================================
  2. "File: xml.vim
  3. "Description: Syntax checking plugin for syntastic.vim
  4. "Maintainer: Sebastian Kusnier <sebastian at kusnier dot net>
  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_xml_xmllint_checker')
  13. finish
  14. endif
  15. let g:loaded_syntastic_xml_xmllint_checker = 1
  16. let s:save_cpo = &cpo
  17. set cpo&vim
  18. " You can use a local installation of DTDs to significantly speed up validation
  19. " and allow you to validate XML data without network access, see xmlcatalog(1)
  20. " and http://www.xmlsoft.org/catalog.html for more information.
  21. function! SyntaxCheckers_xml_xmllint_GetLocList() dict
  22. let makeprg = self.makeprgBuild({
  23. \ 'args': '--xinclude --postvalid',
  24. \ 'args_after': '--noout' })
  25. let errorformat=
  26. \ '%E%f:%l: error : %m,' .
  27. \ '%-G%f:%l: validity error : Validation failed: no DTD found %m,' .
  28. \ '%W%f:%l: warning : %m,' .
  29. \ '%W%f:%l: validity warning : %m,' .
  30. \ '%E%f:%l: validity error : %m,' .
  31. \ '%E%f:%l: parser error : %m,' .
  32. \ '%E%f:%l: %m,' .
  33. \ '%-Z%p^,' .
  34. \ '%-G%.%#'
  35. return SyntasticMake({
  36. \ 'makeprg': makeprg,
  37. \ 'errorformat': errorformat,
  38. \ 'returns': [0, 1, 2, 3, 4, 5] })
  39. endfunction
  40. call g:SyntasticRegistry.CreateAndRegisterChecker({
  41. \ 'filetype': 'xml',
  42. \ 'name': 'xmllint'})
  43. let &cpo = s:save_cpo
  44. unlet s:save_cpo
  45. " vim: set sw=4 sts=4 et fdm=marker: