frosted.vim 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. "============================================================================
  2. "File: frosted.vim
  3. "Description: Syntax checking plugin for syntastic.vim
  4. "Maintainer: LCD 47 <lcd047 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_python_frosted_checker')
  13. finish
  14. endif
  15. let g:loaded_syntastic_python_frosted_checker = 1
  16. let s:save_cpo = &cpo
  17. set cpo&vim
  18. function! SyntaxCheckers_python_frosted_GetLocList() dict
  19. let makeprg = self.makeprgBuild({ 'args_after': '-vb' })
  20. let errorformat =
  21. \ '%f:%l:%c:%m,' .
  22. \ '%E%f:%l: %m,' .
  23. \ '%-Z%p^,' .
  24. \ '%-G%.%#'
  25. let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
  26. let loclist = SyntasticMake({
  27. \ 'makeprg': makeprg,
  28. \ 'errorformat': errorformat,
  29. \ 'env': env,
  30. \ 'returns': [0, 1] })
  31. for e in loclist
  32. let e['col'] += 1
  33. let parts = matchlist(e.text, '\v^([EW]\d+):([^:]*):(.+)')
  34. if len(parts) >= 4
  35. let e['type'] = parts[1][0]
  36. let e['text'] = parts[3] . ' [' . parts[1] . ']'
  37. let e['hl'] = '\V\<' . escape(parts[2], '\') . '\>'
  38. elseif e['text'] =~? '\v^I\d+:'
  39. let e['valid'] = 0
  40. else
  41. let e['vcol'] = 0
  42. endif
  43. endfor
  44. return loclist
  45. endfunction
  46. call g:SyntasticRegistry.CreateAndRegisterChecker({
  47. \ 'filetype': 'python',
  48. \ 'name': 'frosted' })
  49. let &cpo = s:save_cpo
  50. unlet s:save_cpo
  51. " vim: set sw=4 sts=4 et fdm=marker: