lessc.vim 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. "============================================================================
  2. "File: less.vim
  3. "Description: Syntax checking plugin for syntastic.vim
  4. "Maintainer: Julien Blanchard <julien at sideburns dot eu>
  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_less_lessc_checker')
  13. finish
  14. endif
  15. let g:loaded_syntastic_less_lessc_checker = 1
  16. if !exists('g:syntastic_less_use_less_lint')
  17. let g:syntastic_less_use_less_lint = 0
  18. endif
  19. let s:save_cpo = &cpo
  20. set cpo&vim
  21. let s:node_file = 'node ' . syntastic#util#shescape(expand('<sfile>:p:h', 1) . syntastic#util#Slash() . 'less-lint.js')
  22. function! SyntaxCheckers_less_lessc_IsAvailable() dict
  23. call self.log('g:syntastic_less_use_less_lint =', g:syntastic_less_use_less_lint)
  24. return g:syntastic_less_use_less_lint ? executable('node') : executable(self.getExec())
  25. endfunction
  26. function! SyntaxCheckers_less_lessc_GetLocList() dict
  27. call syntastic#log#deprecationWarn('less_options', 'less_lessc_args')
  28. let makeprg = self.makeprgBuild({
  29. \ 'exe': (g:syntastic_less_use_less_lint ? s:node_file : self.getExecEscaped()),
  30. \ 'args_after': '--no-color',
  31. \ 'tail': '> ' . syntastic#util#DevNull() })
  32. let errorformat =
  33. \ '%m in %f on line %l\, column %c:,' .
  34. \ '%m in %f:%l:%c,' .
  35. \ '%-G%.%#'
  36. return SyntasticMake({
  37. \ 'makeprg': makeprg,
  38. \ 'errorformat': errorformat,
  39. \ 'postprocess': ['guards'],
  40. \ 'defaults': {'bufnr': bufnr(''), 'text': 'Syntax error'} })
  41. endfunction
  42. call g:SyntasticRegistry.CreateAndRegisterChecker({
  43. \ 'filetype': 'less',
  44. \ 'name': 'lessc'})
  45. let &cpo = s:save_cpo
  46. unlet s:save_cpo
  47. " vim: set sw=4 sts=4 et fdm=marker: