coffee.vim 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "============================================================================
  2. "File: coffee.vim
  3. "Description: Syntax checking plugin for syntastic.vim
  4. "Maintainer: Lincoln Stoll <l@lds.li>
  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. "
  13. " Note: this script requires CoffeeScript version 1.6.2 or newer.
  14. "
  15. if exists('g:loaded_syntastic_coffee_coffee_checker')
  16. finish
  17. endif
  18. let g:loaded_syntastic_coffee_coffee_checker = 1
  19. let s:save_cpo = &cpo
  20. set cpo&vim
  21. function! SyntaxCheckers_coffee_coffee_IsAvailable() dict
  22. if !executable(self.getExec())
  23. return 0
  24. endif
  25. let ver = self.getVersion(self.getExecEscaped() . ' --version 2>' . syntastic#util#DevNull())
  26. return syntastic#util#versionIsAtLeast(ver, [1, 6, 2])
  27. endfunction
  28. function! SyntaxCheckers_coffee_coffee_GetLocList() dict
  29. let makeprg = self.makeprgBuild({ 'args_after': '-cp' })
  30. let errorformat =
  31. \ '%E%f:%l:%c: %trror: %m,' .
  32. \ 'Syntax%trror: In %f\, %m on line %l,' .
  33. \ '%EError: In %f\, Parse error on line %l: %m,' .
  34. \ '%EError: In %f\, %m on line %l,' .
  35. \ '%W%f(%l): lint warning: %m,' .
  36. \ '%W%f(%l): warning: %m,' .
  37. \ '%E%f(%l): SyntaxError: %m,' .
  38. \ '%-Z%p^,' .
  39. \ '%-G%.%#'
  40. return SyntasticMake({
  41. \ 'makeprg': makeprg,
  42. \ 'errorformat': errorformat })
  43. endfunction
  44. call g:SyntasticRegistry.CreateAndRegisterChecker({
  45. \ 'filetype': 'coffee',
  46. \ 'name': 'coffee'})
  47. let &cpo = s:save_cpo
  48. unlet s:save_cpo
  49. " vim: set sw=4 sts=4 et fdm=marker: