diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2015-01-23 21:09:23 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2015-01-23 21:09:23 +0100 |
commit | 6745c49110838db9ac39e85bbcf690b40bc20f83 (patch) | |
tree | 3b1c42f67bacb5ddb5b6afc5b4610f4c238877a7 /ftplugin/latex-box/latexmk.vim | |
parent | 1a97304cf642e9f887122e162b1999768b60c9d7 (diff) | |
download | vim-polyglot-1.11.2.tar.gz vim-polyglot-1.11.2.zip |
Update all packagesv1.11.2
Diffstat (limited to '')
-rw-r--r-- | ftplugin/latex-box/latexmk.vim | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/ftplugin/latex-box/latexmk.vim b/ftplugin/latex-box/latexmk.vim index 6c5d3eb1..1285bc64 100644 --- a/ftplugin/latex-box/latexmk.vim +++ b/ftplugin/latex-box/latexmk.vim @@ -443,10 +443,32 @@ function! LatexBox_LatexErrors(status, ...) endif endfunction +" Redefine uniq() for compatibility with older Vim versions (< 7.4.218) +function! s:uniq(list) + if exists('*uniq') + return uniq(a:list) + elseif len(a:list) <= 1 + return a:list + endif + + let last_element = get(a:list,0) + let uniq_list = [last_element] + + for i in range(1, len(a:list)-1) + let next_element = get(a:list, i) + if last_element == next_element + continue + endif + let last_element = next_element + call add(uniq_list, next_element) + endfor + return uniq_list +endfunction + function! s:log_contains_error(file) let lines = readfile(a:file) let lines = filter(lines, 'v:val =~ ''^.*:\d\+: ''') - let lines = uniq(map(lines, 'matchstr(v:val, ''^.*\ze:\d\+:'')')) + let lines = s:uniq(map(lines, 'matchstr(v:val, ''^.*\ze:\d\+:'')')) let lines = filter(lines, 'filereadable(fnameescape(v:val))') return len(lines) > 0 endfunction |