Updated vim plugins

This commit is contained in:
amix committed 2015-02-24 10:45:22 +00:00
1 parent 8fa0bd4574
commit d195ccb777
104 files changed
+1743 -1464

No files matched your search

@@ -8,11 +8,11 @@ set cpo&vim
" Public functions {{{1
function! syntastic#util#isRunningWindows() " {{{2
function! syntastic#util#isRunningWindows() abort " {{{2
return has('win16') || has('win32') || has('win64')
endfunction " }}}2
function! syntastic#util#DevNull() " {{{2
function! syntastic#util#DevNull() abort " {{{2
if syntastic#util#isRunningWindows()
return 'NUL'
endif
@@ -24,8 +24,12 @@ function! syntastic#util#Slash() abort " {{{2
return (!exists("+shellslash") || &shellslash) ? '/' : '\'
endfunction " }}}2
function! syntastic#util#CygwinPath(path) abort " {{{2
return substitute(system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g')
endfunction " }}}2
" Create a temporary directory
function! syntastic#util#tmpdir() " {{{2
function! syntastic#util#tmpdir() abort " {{{2
let tempdir = ''
if (has('unix') || has('mac')) && executable('mktemp')
@@ -41,7 +45,7 @@ function! syntastic#util#tmpdir() " {{{2
if has('win32') || has('win64')
let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . getpid()
elseif has('win32unix')
let tempdir = s:CygwinPath('/tmp/vim-syntastic-' . getpid())
let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . getpid())
elseif $TMPDIR != ''
let tempdir = $TMPDIR . '/vim-syntastic-' . getpid()
else
@@ -60,7 +64,7 @@ function! syntastic#util#tmpdir() " {{{2
endfunction " }}}2
" Recursively remove a directory
function! syntastic#util#rmrf(what) " {{{2
function! syntastic#util#rmrf(what) abort " {{{2
" try to make sure we don't delete directories we didn't create
if a:what !~? 'vim-syntastic-'
return
@@ -94,7 +98,7 @@ endfunction " }}}2
"returns
"
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
function! syntastic#util#parseShebang() " {{{2
function! syntastic#util#parseShebang() abort " {{{2
for lnum in range(1, 5)
let line = getline(lnum)
if line =~ '^#!'
@@ -109,7 +113,7 @@ function! syntastic#util#parseShebang() " {{{2
endfunction " }}}2
" Get the value of a variable. Allow local variables to override global ones.
function! syntastic#util#var(name, ...) " {{{2
function! syntastic#util#var(name, ...) abort " {{{2
return
\ exists('b:syntastic_' . a:name) ? b:syntastic_{a:name} :
\ exists('g:syntastic_' . a:name) ? g:syntastic_{a:name} :
@@ -117,7 +121,7 @@ function! syntastic#util#var(name, ...) " {{{2
endfunction " }}}2
" Parse a version string. Return an array of version components.
function! syntastic#util#parseVersion(version) " {{{2
function! syntastic#util#parseVersion(version) abort " {{{2
return map(split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)')
endfunction " }}}2
@@ -127,13 +131,13 @@ endfunction " }}}2
" the "missing" elements will be assumed to be 0 for the purposes of checking.
"
" See http://semver.org for info about version numbers.
function! syntastic#util#versionIsAtLeast(installed, required) " {{{2
function! syntastic#util#versionIsAtLeast(installed, required) abort " {{{2
return syntastic#util#compareLexi(a:installed, a:required) >= 0
endfunction " }}}2
" Almost lexicographic comparison of two lists of integers. :) If lists
" have different lengths, the "missing" elements are assumed to be 0.
function! syntastic#util#compareLexi(a, b) " {{{2
function! syntastic#util#compareLexi(a, b) abort " {{{2
for idx in range(max([len(a:a), len(a:b)]))
let a_element = str2nr(get(a:a, idx, 0))
let b_element = str2nr(get(a:b, idx, 0))
@@ -150,7 +154,7 @@ endfunction " }}}2
let s:_width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
lockvar s:_width
function! syntastic#util#screenWidth(str, tabstop) " {{{2
function! syntastic#util#screenWidth(str, tabstop) abort " {{{2
let chunks = split(a:str, "\t", 1)
let width = s:_width(chunks[-1])
for c in chunks[:-2]
@@ -161,7 +165,7 @@ function! syntastic#util#screenWidth(str, tabstop) " {{{2
endfunction " }}}2
"print as much of a:msg as possible without "Press Enter" prompt appearing
function! syntastic#util#wideMsg(msg) " {{{2
function! syntastic#util#wideMsg(msg) abort " {{{2
let old_ruler = &ruler
let old_showcmd = &showcmd
@@ -185,7 +189,7 @@ function! syntastic#util#wideMsg(msg) " {{{2
endfunction " }}}2
" Check whether a buffer is loaded, listed, and not hidden
function! syntastic#util#bufIsActive(buffer) " {{{2
function! syntastic#util#bufIsActive(buffer) abort " {{{2
" convert to number, or hell breaks loose
let buf = str2nr(a:buffer)
@@ -205,7 +209,7 @@ endfunction " }}}2
" 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#findInParent(what, where) " {{{2
function! syntastic#util#findInParent(what, where) abort " {{{2
let here = fnamemodify(a:where, ':p')
let root = syntastic#util#Slash()
@@ -237,7 +241,7 @@ function! syntastic#util#findInParent(what, where) " {{{2
endfunction " }}}2
" Returns unique elements in a list
function! syntastic#util#unique(list) " {{{2
function! syntastic#util#unique(list) abort " {{{2
let seen = {}
let uniques = []
for e in a:list
@@ -250,17 +254,17 @@ function! syntastic#util#unique(list) " {{{2
endfunction " }}}2
" A less noisy shellescape()
function! syntastic#util#shescape(string) " {{{2
return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string)
function! syntastic#util#shescape(string) abort " {{{2
return a:string =~# '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string)
endfunction " }}}2
" A less noisy shellescape(expand())
function! syntastic#util#shexpand(string, ...) " {{{2
function! syntastic#util#shexpand(string, ...) abort " {{{2
return syntastic#util#shescape(a:0 ? expand(a:string, a:1) : expand(a:string, 1))
endfunction " }}}2
" Escape arguments
function! syntastic#util#argsescape(opt) " {{{2
function! syntastic#util#argsescape(opt) abort " {{{2
if type(a:opt) == type('') && a:opt != ''
return [a:opt]
elseif type(a:opt) == type([])
@@ -271,7 +275,7 @@ function! syntastic#util#argsescape(opt) " {{{2
endfunction " }}}2
" decode XML entities
function! syntastic#util#decodeXMLEntities(string) " {{{2
function! syntastic#util#decodeXMLEntities(string) abort " {{{2
let str = a:string
let str = substitute(str, '\m&lt;', '<', 'g')
let str = substitute(str, '\m&gt;', '>', 'g')
@@ -281,7 +285,7 @@ function! syntastic#util#decodeXMLEntities(string) " {{{2
return str
endfunction " }}}2
function! syntastic#util#redraw(full) " {{{2
function! syntastic#util#redraw(full) abort " {{{2
if a:full
redraw!
else
@@ -289,7 +293,7 @@ function! syntastic#util#redraw(full) " {{{2
endif
endfunction " }}}2
function! syntastic#util#dictFilter(errors, filter) " {{{2
function! syntastic#util#dictFilter(errors, filter) abort " {{{2
let rules = s:_translateFilter(a:filter)
" call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, "applying filter:", rules)
try
@@ -303,7 +307,7 @@ endfunction " }}}2
" Return a [high, low] list of integers, representing the time
" (hopefully high resolution) since program start
" TODO: This assumes reltime() returns a list of integers.
function! syntastic#util#stamp() " {{{2
function! syntastic#util#stamp() abort " {{{2
return reltime(g:_SYNTASTIC_START)
endfunction " }}}2
@@ -311,7 +315,7 @@ endfunction " }}}2
" Private functions {{{1
function! s:_translateFilter(filters) " {{{2
function! s:_translateFilter(filters) abort " {{{2
let conditions = []
for k in keys(a:filters)
if type(a:filters[k]) == type([])
@@ -327,7 +331,7 @@ function! s:_translateFilter(filters) " {{{2
return len(conditions) == 1 ? conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
endfunction " }}}2
function! s:_translateElement(key, term) " {{{2
function! s:_translateElement(key, term) abort " {{{2
let fkey = a:key
if fkey[0] == '!'
let fkey = fkey[1:]
@@ -365,7 +369,7 @@ function! s:_translateElement(key, term) " {{{2
return ret
endfunction " }}}2
function! s:_rmrf(what) " {{{2
function! s:_rmrf(what) abort " {{{2
if !exists('s:rmdir')
let s:rmdir = syntastic#util#shescape(get(g:, 'netrw_localrmdir', 'rmdir'))
endif