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
|
2014-01-03 04:29:08 -05:00
|
|
|
let g:loaded_syntastic_less_lessc_checker = 1
|
2013-02-21 10:50:41 -05:00
|
|
|
|
2011-12-11 09:33:44 -05:00
|
|
|
if !exists("g:syntastic_less_options")
|
2014-01-28 14:44:44 -05:00
|
|
|
let g:syntastic_less_options = ""
|
2011-12-11 09:33:44 -05:00
|
|
|
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
|
|
|
|
|
2014-01-05 01:31:29 -05:00
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
2012-09-23 10:26:59 -04:00
|
|
|
if g:syntastic_less_use_less_lint
|
2014-02-06 04:58:30 -05:00
|
|
|
let s:check_file = 'node ' . syntastic#util#shescape(expand('<sfile>:p:h') . syntastic#util#Slash() . '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,
|
2014-01-28 14:44:44 -05:00
|
|
|
\ 'args_after': '--no-color',
|
2014-01-26 15:38:35 -05: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'})
|
2014-01-03 04:29:08 -05:00
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
|
|
|
" vim: set et sts=4 sw=4:
|