mirror of
https://github.com/amix/vimrc
synced 2025-07-09 10:45:00 +08:00
Updated plugins
This commit is contained in:
@ -173,10 +173,17 @@ endfunction " }}}2
|
||||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:_log_timestamp() abort " {{{2
|
||||
function! s:_log_timestamp_smart() abort " {{{2
|
||||
return printf('syntastic: %f: ', reltimefloat(reltime(g:_SYNTASTIC_START)))
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_log_timestamp_dumb() abort " {{{2
|
||||
return 'syntastic: ' . split(reltimestr(reltime(g:_SYNTASTIC_START)))[0] . ': '
|
||||
endfunction " }}}2
|
||||
|
||||
let s:_log_timestamp = function(has('float') && exists('*reltimefloat') ? 's:_log_timestamp_smart' : 's:_log_timestamp_dumb')
|
||||
lockvar s:_log_timestamp
|
||||
|
||||
function! s:_format_variable(name) abort " {{{2
|
||||
let vals = []
|
||||
if exists('g:syntastic_' . a:name)
|
||||
|
@ -284,6 +284,42 @@ function! syntastic#preprocess#rparse(errors) abort " {{{2
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#scss_lint(errors) abort " {{{2
|
||||
let errs = join(a:errors, '')
|
||||
if errs ==# ''
|
||||
return []
|
||||
endif
|
||||
|
||||
let json = s:_decode_JSON(errs)
|
||||
|
||||
let out = []
|
||||
if type(json) == type({})
|
||||
for fname in keys(json)
|
||||
if type(json[fname]) == type([])
|
||||
for e in json[fname]
|
||||
try
|
||||
cal add(out, fname . ':' .
|
||||
\ e['severity'][0] . ':' .
|
||||
\ e['line'] . ':' .
|
||||
\ e['column'] . ':' .
|
||||
\ e['length'] . ':' .
|
||||
\ ( has_key(e, 'linter') ? e['linter'] . ': ' : '' ) .
|
||||
\ e['reason'])
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker scss/scss_lint: unrecognized error item ' . string(e))
|
||||
let out = []
|
||||
endtry
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker scss/scss_lint: unrecognized error format')
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker scss/scss_lint: unrecognized error format')
|
||||
endif
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#stylelint(errors) abort " {{{2
|
||||
let out = []
|
||||
|
||||
|
@ -51,7 +51,7 @@ endfunction " }}}2
|
||||
function! syntastic#util#tmpdir() abort " {{{2
|
||||
let tempdir = ''
|
||||
|
||||
if (has('unix') || has('mac')) && executable('mktemp')
|
||||
if (has('unix') || has('mac')) && executable('mktemp') && !has('win32unix')
|
||||
" TODO: option "-t" to mktemp(1) is not portable
|
||||
let tmp = $TMPDIR !=# '' ? $TMPDIR : $TMP !=# '' ? $TMP : '/tmp'
|
||||
let out = split(syntastic#util#system('mktemp -q -d ' . tmp . '/vim-syntastic-' . getpid() . '-XXXXXXXX'), "\n")
|
||||
@ -90,18 +90,7 @@ function! syntastic#util#rmrf(what) abort " {{{2
|
||||
endif
|
||||
|
||||
if getftype(a:what) ==# 'dir'
|
||||
if !exists('s:rmrf')
|
||||
let s:rmrf =
|
||||
\ has('unix') || has('mac') ? 'rm -rf' :
|
||||
\ has('win32') || has('win64') ? 'rmdir /S /Q' :
|
||||
\ has('win16') || has('win95') || has('dos16') || has('dos32') ? 'deltree /Y' : ''
|
||||
endif
|
||||
|
||||
if s:rmrf !=# ''
|
||||
silent! call syntastic#util#system(s:rmrf . ' ' . syntastic#util#shescape(a:what))
|
||||
else
|
||||
call s:_rmrf(a:what)
|
||||
endif
|
||||
call s:_delete(a:what, 'rf')
|
||||
else
|
||||
silent! call delete(a:what)
|
||||
endif
|
||||
@ -274,8 +263,9 @@ function! syntastic#util#unique(list) abort " {{{2
|
||||
let seen = {}
|
||||
let uniques = []
|
||||
for e in a:list
|
||||
if !has_key(seen, e)
|
||||
let seen[e] = 1
|
||||
let k = string(e)
|
||||
if !has_key(seen, k)
|
||||
let seen[k] = 1
|
||||
call add(uniques, e)
|
||||
endif
|
||||
endfor
|
||||
@ -478,6 +468,27 @@ function! s:_translateElement(key, term) abort " {{{2
|
||||
return ret
|
||||
endfunction " }}}2
|
||||
|
||||
" @vimlint(EVL103, 1, a:flags)
|
||||
function! s:_delete_dumb(what, flags) abort " {{{2
|
||||
if !exists('s:rmrf')
|
||||
let s:rmrf =
|
||||
\ has('unix') || has('mac') ? 'rm -rf' :
|
||||
\ has('win32') || has('win64') ? 'rmdir /S /Q' :
|
||||
\ has('win16') || has('win95') || has('dos16') || has('dos32') ? 'deltree /Y' : ''
|
||||
endif
|
||||
|
||||
if s:rmrf !=# ''
|
||||
silent! call syntastic#util#system(s:rmrf . ' ' . syntastic#util#shescape(a:what))
|
||||
else
|
||||
call s:_rmrf(a:what)
|
||||
endif
|
||||
endfunction " }}}2
|
||||
" @vimlint(EVL103, 0, a:flags)
|
||||
|
||||
" delete(dir, 'rf') was added in Vim 7.4.1107, but it didn't become usable until 7.4.1128
|
||||
let s:_delete = function(v:version > 704 || (v:version == 704 && has('patch1128')) ? 'delete' : 's:_delete_dumb')
|
||||
lockvar s:_delete
|
||||
|
||||
function! s:_rmrf(what) abort " {{{2
|
||||
if !exists('s:rmdir')
|
||||
let s:rmdir = syntastic#util#shescape(get(g:, 'netrw_localrmdir', 'rmdir'))
|
||||
|
Reference in New Issue
Block a user