Updated plugins
This commit is contained in:
1 parent
768c72a3ed
commit
3b37bba6cd
239 files changed
+8132
-3198
No files matched your search
@@ -107,16 +107,16 @@ function! syntastic#util#rmrf(what) abort " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
"search the first 5 lines of the file for a magic number and return a map
|
||||
"containing the args and the executable
|
||||
" Search the first 5 lines of the file for a magic number and return a map
|
||||
" containing the args and the executable
|
||||
"
|
||||
"e.g.
|
||||
" e.g.
|
||||
"
|
||||
"#!/usr/bin/perl -f -bar
|
||||
" #!/usr/bin/perl -f -bar
|
||||
"
|
||||
"returns
|
||||
" returns
|
||||
"
|
||||
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
|
||||
" {'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
|
||||
function! syntastic#util#parseShebang() abort " {{{2
|
||||
for lnum in range(1, 5)
|
||||
let line = getline(lnum)
|
||||
@@ -183,7 +183,7 @@ function! syntastic#util#screenWidth(str, tabstop) abort " {{{2
|
||||
return width
|
||||
endfunction " }}}2
|
||||
|
||||
"print as much of a:msg as possible without "Press Enter" prompt appearing
|
||||
" Print as much of a:msg as possible without "Press Enter" prompt appearing
|
||||
function! syntastic#util#wideMsg(msg) abort " {{{2
|
||||
let old_ruler = &ruler
|
||||
let old_showcmd = &showcmd
|
||||
@@ -226,7 +226,7 @@ function! syntastic#util#bufIsActive(buffer) abort " {{{2
|
||||
return 0
|
||||
endfunction " }}}2
|
||||
|
||||
" start in directory a:where and walk up the parent folders until it finds a
|
||||
" Start in directory a:where and walk up the parent folders until it finds a
|
||||
" file named a:what; return path to that file
|
||||
function! syntastic#util#findFileInParent(what, where) abort " {{{2
|
||||
let old_suffixesadd = &suffixesadd
|
||||
@@ -236,7 +236,7 @@ function! syntastic#util#findFileInParent(what, where) abort " {{{2
|
||||
return file
|
||||
endfunction " }}}2
|
||||
|
||||
" start in directory a:where and walk up the parent folders until it finds a
|
||||
" Start in directory a:where and walk up the parent folders until it finds a
|
||||
" file matching a:what; return path to that file
|
||||
function! syntastic#util#findGlobInParent(what, where) abort " {{{2
|
||||
let here = fnamemodify(a:where, ':p')
|
||||
@@ -303,7 +303,7 @@ function! syntastic#util#argsescape(opt) abort " {{{2
|
||||
return []
|
||||
endfunction " }}}2
|
||||
|
||||
" decode XML entities
|
||||
" Decode XML entities
|
||||
function! syntastic#util#decodeXMLEntities(string) abort " {{{2
|
||||
let str = a:string
|
||||
let str = substitute(str, '\m<', '<', 'g')
|
||||
@@ -339,6 +339,87 @@ function! syntastic#util#stamp() abort " {{{2
|
||||
return split( split(reltimestr(reltime(g:_SYNTASTIC_START)))[0], '\.' )
|
||||
endfunction " }}}2
|
||||
|
||||
let s:_wid_base = 'syntastic_' . getpid() . '_' . reltimestr(g:_SYNTASTIC_START) . '_'
|
||||
let s:_wid_pool = 0
|
||||
|
||||
" Add unique IDs to windows
|
||||
function! syntastic#util#setWids() abort " {{{2
|
||||
for tab in range(1, tabpagenr('$'))
|
||||
for win in range(1, tabpagewinnr(tab, '$'))
|
||||
if gettabwinvar(tab, win, 'syntastic_wid') ==# ''
|
||||
call settabwinvar(tab, win, 'syntastic_wid', s:_wid_base . s:_wid_pool)
|
||||
let s:_wid_pool += 1
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction " }}}2
|
||||
|
||||
let s:_str2float = function(exists('*str2float') ? 'str2float' : 'str2nr')
|
||||
lockvar s:_str2float
|
||||
|
||||
function! syntastic#util#str2float(val) abort " {{{2
|
||||
return s:_str2float(a:val)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#float2str(val) abort " {{{2
|
||||
return s:_float2str(a:val)
|
||||
endfunction " }}}2
|
||||
|
||||
" Crude printf()-like width formatter. Handles wide characters.
|
||||
function! syntastic#util#wformat(format, str) abort " {{{2
|
||||
if a:format ==# ''
|
||||
return a:str
|
||||
endif
|
||||
|
||||
echomsg string(a:format) . ', ' . string(a:str)
|
||||
let specs = matchlist(a:format, '\v^(-?)(0?)(%([1-9]\d*))?%(\.(\d+))?$')
|
||||
if len(specs) < 5
|
||||
return a:str
|
||||
endif
|
||||
|
||||
let flushleft = specs[1] ==# '-'
|
||||
let lpad = specs[2] ==# '0' ? '0' : ' '
|
||||
let minlen = str2nr(specs[3])
|
||||
let maxlen = str2nr(specs[4])
|
||||
let out = substitute(a:str, "\t", ' ', 'g')
|
||||
|
||||
if maxlen && s:_width(out) > maxlen
|
||||
let chars = filter(split(out, '\zs\ze', 1), 'v:val !=# ""')
|
||||
let out = ''
|
||||
|
||||
if flushleft
|
||||
for c in chars
|
||||
if s:_width(out . c) < maxlen
|
||||
let out .= c
|
||||
else
|
||||
let out .= &encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '>'
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
call reverse(chars)
|
||||
for c in chars
|
||||
if s:_width(c . out) < maxlen
|
||||
let out = c . out
|
||||
else
|
||||
let out = (&encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '<') . out
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endif
|
||||
|
||||
if minlen && s:_width(out) < minlen
|
||||
if flushleft
|
||||
let out .= repeat(' ', minlen - s:_width(out))
|
||||
else
|
||||
let out = repeat(lpad, minlen - s:_width(out)) . out
|
||||
endif
|
||||
endif
|
||||
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
" Private functions {{{1
|
||||
@@ -416,6 +497,17 @@ function! s:_rmrf(what) abort " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_float2str_smart(val) abort " {{{2
|
||||
return printf('%.1f', a:val)
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_float2str_dumb(val) abort " {{{2
|
||||
return a:val
|
||||
endfunction " }}}2
|
||||
|
||||
let s:_float2str = function(has('float') ? 's:_float2str_smart' : 's:_float2str_dumb')
|
||||
lockvar s:_float2str
|
||||
|
||||
" }}}1
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
||||
Reference in new issue
Block a user