remark_lint.vim 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "============================================================================
  2. "File: remark.vim
  3. "Description: Syntax checking plugin for syntastic using remark-lint
  4. " (https://github.com/remarkjs/remark-lint)
  5. "Maintainer: Tim Carry <tim at pixelastic dot com>
  6. "License: This program is free software. It comes without any warranty,
  7. " to the extent permitted by applicable law. You can redistribute
  8. " it and/or modify it under the terms of the Do What The Fuck You
  9. " Want To Public License, Version 2, as published by Sam Hocevar.
  10. " See http://sam.zoy.org/wtfpl/COPYING for more details.
  11. "
  12. "============================================================================
  13. if exists('g:loaded_syntastic_markdown_remark_lint_checker')
  14. finish
  15. endif
  16. let g:loaded_syntastic_markdown_remark_lint_checker = 1
  17. let s:save_cpo = &cpo
  18. set cpo&vim
  19. function! SyntaxCheckers_markdown_remark_lint_GetLocList() dict
  20. let makeprg = self.makeprgBuild({ 'args_before': '--quiet --no-stdout --no-color' })
  21. let errorformat =
  22. \ '%f:%t:%l:%c:%n:%m,' .
  23. \ '%f:%t:%l:%c:%m'
  24. let loclist = SyntasticMake({
  25. \ 'makeprg': makeprg,
  26. \ 'errorformat': errorformat,
  27. \ 'preprocess': 'remark_lint',
  28. \ 'subtype': 'Style',
  29. \ 'returns': [0] })
  30. for e in loclist
  31. if get(e, 'col', 0) && get(e, 'nr', 0)
  32. let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . (e['nr'] + 1) . 'c'
  33. let e['nr'] = 0
  34. endif
  35. endfor
  36. return loclist
  37. endfunction
  38. call g:SyntasticRegistry.CreateAndRegisterChecker({
  39. \ 'filetype': 'markdown',
  40. \ 'name': 'remark_lint',
  41. \ 'exec': 'remark'})
  42. let &cpo = s:save_cpo
  43. unlet s:save_cpo
  44. " vim: set sw=4 sts=4 et fdm=marker: