2010-12-07 11:25:27 -05:00
|
|
|
"============================================================================
|
|
|
|
"File: less.vim
|
|
|
|
"Description: Syntax checking plugin for syntastic.vim
|
2010-12-07 11:38:36 -05:00
|
|
|
"Maintainer: Julien Blanchard <julien at sideburns dot eu>
|
2010-12-07 11:25:27 -05:00
|
|
|
"License: This program is free software. It comes without any warranty,
|
|
|
|
" to the extent permitted by applicable law. You can redistribute
|
|
|
|
" it and/or modify it under the terms of the Do What The Fuck You
|
|
|
|
" Want To Public License, Version 2, as published by Sam Hocevar.
|
|
|
|
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
|
|
|
"
|
|
|
|
"============================================================================
|
2012-08-31 11:48:17 -04:00
|
|
|
|
|
|
|
" To send additional options to less use the variable g:syntastic_less_options.
|
|
|
|
" The default is
|
|
|
|
" let g:syntastic_less_options = "--no-color"
|
|
|
|
"
|
|
|
|
" To use less-lint instead of less set the variable
|
|
|
|
" g:syntastic_less_use_less_lint.
|
|
|
|
|
2013-02-21 10:50:41 -05:00
|
|
|
if exists("g:loaded_syntastic_less_lessc_checker")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let g:loaded_syntastic_less_lessc_checker=1
|
|
|
|
|
2011-12-11 09:33:44 -05:00
|
|
|
if !exists("g:syntastic_less_options")
|
|
|
|
let g:syntastic_less_options = "--no-color"
|
|
|
|
endif
|
|
|
|
|
2012-09-23 10:26:59 -04:00
|
|
|
if !exists("g:syntastic_less_use_less_lint")
|
|
|
|
let g:syntastic_less_use_less_lint = 0
|
|
|
|
endif
|
|
|
|
|
|
|
|
if g:syntastic_less_use_less_lint
|
2012-08-31 11:48:17 -04:00
|
|
|
let s:check_file = 'node ' . expand('<sfile>:p:h') . '/less-lint.js'
|
2012-09-26 07:32:37 -04:00
|
|
|
else
|
|
|
|
let s:check_file = 'lessc'
|
2013-09-27 03:35:46 -04:00
|
|
|
endif
|
2012-08-31 11:48:17 -04:00
|
|
|
|
2013-10-28 11:30:25 -04:00
|
|
|
function! SyntaxCheckers_less_lessc_IsAvailable() dict
|
|
|
|
return g:syntastic_less_use_less_lint ? executable('node') : executable('lessc')
|
2013-01-27 15:08:30 -05:00
|
|
|
endfunction
|
|
|
|
|
2013-10-28 07:53:33 -04:00
|
|
|
function! SyntaxCheckers_less_lessc_GetLocList() dict
|
2013-11-01 05:51:47 -04:00
|
|
|
let makeprg = self.makeprgBuild({
|
2013-05-31 14:05:45 -04:00
|
|
|
\ 'exe': s:check_file,
|
|
|
|
\ 'args': g:syntastic_less_options,
|
2013-11-01 05:51:47 -04:00
|
|
|
\ 'tail': syntastic#util#DevNull() })
|
2013-05-31 14:05:45 -04:00
|
|
|
|
2013-11-06 07:57:00 -05:00
|
|
|
let errorformat =
|
|
|
|
\ '%m in %f on line %l\, column %c:,' .
|
|
|
|
\ '%m in %f:%l:%c,' .
|
|
|
|
\ '%-G%.%#'
|
2012-01-19 07:59:40 -05:00
|
|
|
|
2013-05-31 14:05:45 -04:00
|
|
|
return SyntasticMake({
|
|
|
|
\ 'makeprg': makeprg,
|
|
|
|
\ 'errorformat': errorformat,
|
|
|
|
\ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} })
|
2011-02-12 00:51:03 -05:00
|
|
|
endfunction
|
2011-03-16 06:45:55 -04:00
|
|
|
|
2013-01-27 15:08:30 -05:00
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'less',
|
|
|
|
\ 'name': 'lessc'})
|