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.
|
|
|
|
|
2010-12-07 11:25:27 -05:00
|
|
|
if exists("loaded_less_syntax_checker")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let loaded_less_syntax_checker = 1
|
|
|
|
|
2010-12-08 19:09:29 -05:00
|
|
|
"bail if the user doesnt have the lessc binary installed
|
2010-12-07 11:25:27 -05:00
|
|
|
if !executable("lessc")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
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'
|
2012-08-31 11:48:17 -04:00
|
|
|
end
|
|
|
|
|
2010-12-07 11:25:27 -05:00
|
|
|
function! SyntaxCheckers_less_GetLocList()
|
2012-08-31 11:48:17 -04:00
|
|
|
let makeprg = s:check_file . ' ' . g:syntastic_less_options . ' ' .
|
2012-10-23 17:37:11 -04:00
|
|
|
\ shellescape(expand('%')) . ' ' . syntastic#util#DevNull()
|
2012-01-19 13:28:18 -05:00
|
|
|
let errorformat = '%m in %f:%l:%c'
|
2012-01-19 07:59:40 -05:00
|
|
|
|
2011-12-09 08:44:54 -05:00
|
|
|
return SyntasticMake({ 'makeprg': makeprg,
|
|
|
|
\ 'errorformat': errorformat,
|
2011-12-11 09:32:53 -05:00
|
|
|
\ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} })
|
2011-02-12 00:51:03 -05:00
|
|
|
endfunction
|
2011-03-16 06:45:55 -04:00
|
|
|
|