Merge #9231 'vim-patch:8.1.{115,143,311,352}'

This commit is contained in:
Justin M. Keyes
2018-11-14 11:27:17 +01:00
committed by GitHub
4 changed files with 97 additions and 26 deletions

View File

@@ -153,15 +153,14 @@ fun! tar#Browse(tarfile)
let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
endif endif
let gzip_command = s:get_gzip_command(tarfile)
let curlast= line("$") let curlast= line("$")
if tarfile =~# '\.\(gz\|tgz\)$' if tarfile =~# '\.\(gz\|tgz\)$'
let gzip_command = s:get_gzip_command(tarfile)
" call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") " call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif tarfile =~# '\.lrp' elseif tarfile =~# '\.lrp'
" call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ") " call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! cat -- ".shellescape(tarfile,1)."|" . gzip_command . " -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - " exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
elseif tarfile =~# '\.\(bz2\|tbz\|tb2\)$' elseif tarfile =~# '\.\(bz2\|tbz\|tb2\)$'
" call Decho("3: exe silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") " call Decho("3: exe silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
@@ -291,17 +290,16 @@ fun! tar#Read(fname,mode)
let tar_secure= " " let tar_secure= " "
endif endif
let gzip_command = s:get_gzip_command(tarfile)
if tarfile =~# '\.bz2$' if tarfile =~# '\.bz2$'
" call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) " call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.\(gz\|tgz\)$' elseif tarfile =~# '\.\(gz\|tgz\)$'
let gzip_command = s:get_gzip_command(tarfile)
" call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1)) " call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1))
exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.lrp$' elseif tarfile =~# '\.lrp$'
" call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) " call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! cat -- ".shellescape(tarfile,1)." | " . gzip_command . " -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.lzma$' elseif tarfile =~# '\.lzma$'
" call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) " call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
@@ -589,8 +587,9 @@ fun! tar#Vimuntar(...)
" if necessary, decompress the tarball; then, extract it " if necessary, decompress the tarball; then, extract it
if tartail =~ '\.tgz' if tartail =~ '\.tgz'
if executable("bzip2") let gzip_command = s:get_gzip_command(tarfile)
silent exe "!bzip2 -d ".shellescape(tartail) if executable(gzip_command)
silent exe "!" . gzip_command . " -d ".shellescape(tartail)
elseif executable("gunzip") elseif executable("gunzip")
silent exe "!gunzip ".shellescape(tartail) silent exe "!gunzip ".shellescape(tartail)
elseif executable("gzip") elseif executable("gzip")
@@ -630,11 +629,24 @@ fun! tar#Vimuntar(...)
endfun endfun
func s:get_gzip_command(file) func s:get_gzip_command(file)
if a:file =~# 'z$' && executable('bzip2') " Try using the "file" command to get the actual compression type, since
" Some .tgz files are actually compressed with bzip2. Since bzip2 can " there is no standard way for the naming: ".tgz", ".tbz", ".txz", etc.
" handle the format from gzip, use it if the command exists. " If the "file" command doesn't work fall back to just using the file name.
if a:file =~# 'z$'
let filetype = system('file ' . a:file)
if filetype =~ 'bzip2 compressed' && executable('bzip2')
return 'bzip2' return 'bzip2'
endif endif
if filetype =~ 'XZ compressed' && executable('xz')
return 'xz'
endif
endif
if a:file =~# 'bz2$'
return 'bzip2'
endif
if a:file =~# 'xz$'
return 'xz'
endif
return 'gzip' return 'gzip'
endfunc endfunc

View File

@@ -0,0 +1,43 @@
" cfilter.vim: Plugin to filter entries from a quickfix/location list
" Last Change: May 12, 2018
" Maintainer: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
" Version: 1.0
"
" Commands to filter the quickfix list:
" :Cfilter[!] {pat}
" Create a new quickfix list from entries matching {pat} in the current
" quickfix list. Both the file name and the text of the entries are
" matched against {pat}. If ! is supplied, then entries not matching
" {pat} are used.
" :Lfilter[!] {pat}
" Same as :Cfilter but operates on the current location list.
"
if exists("loaded_cfilter")
finish
endif
let loaded_cfilter = 1
func s:Qf_filter(qf, pat, bang)
if a:qf
let Xgetlist = function('getqflist')
let Xsetlist = function('setqflist')
let cmd = ':Cfilter' . a:bang
else
let Xgetlist = function('getloclist', [0])
let Xsetlist = function('setloclist', [0])
let cmd = ':Lfilter' . a:bang
endif
if a:bang == '!'
let cond = 'v:val.text !~# a:pat && bufname(v:val.bufnr) !~# a:pat'
else
let cond = 'v:val.text =~# a:pat || bufname(v:val.bufnr) =~# a:pat'
endif
let items = filter(Xgetlist(), cond)
let title = cmd . ' ' . a:pat
call Xsetlist([], ' ', {'title' : title, 'items' : items})
endfunc
com! -nargs=+ -bang Cfilter call s:Qf_filter(1, <q-args>, <q-bang>)
com! -nargs=+ -bang Lfilter call s:Qf_filter(0, <q-args>, <q-bang>)

View File

@@ -1,5 +1,5 @@
" matchit.vim: (global plugin) Extended "%" matching " matchit.vim: (global plugin) Extended "%" matching
" Last Change: 2017 Sep 15 " Last Change: 2018 Jul 3 by Christian Brabandt
" Maintainer: Benji Fisher PhD <benji@member.AMS.org> " Maintainer: Benji Fisher PhD <benji@member.AMS.org>
" Version: 1.13.3, for Vim 6.3+ " Version: 1.13.3, for Vim 6.3+
" Fix from Tommy Allen included. " Fix from Tommy Allen included.
@@ -268,7 +268,7 @@ function! s:Match_wrapper(word, forward, mode) range
" execute "normal!" . curcol . "l" " execute "normal!" . curcol . "l"
" endif " endif
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
let skip = "0" let skip = '0'
else else
execute "if " . skip . "| let skip = '0' | endif" execute "if " . skip . "| let skip = '0' | endif"
endif endif
@@ -708,10 +708,16 @@ fun! s:MultiMatch(spflag, mode)
let openpat = substitute(openpat, ',', '\\|', 'g') let openpat = substitute(openpat, ',', '\\|', 'g')
let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g') let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g')
let closepat = substitute(closepat, ',', '\\|', 'g') let closepat = substitute(closepat, ',', '\\|', 'g')
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
let skip = '0' let skip = '0'
else else
try
execute "if " . skip . "| let skip = '0' | endif" execute "if " . skip . "| let skip = '0' | endif"
catch /^Vim\%((\a\+)\)\=:E363/
" We won't find anything, so skip searching, should keep Vim responsive.
return
endtry
endif endif
mark ' mark '
let level = v:count1 let level = v:count1

View File

@@ -1,6 +1,6 @@
" Vim plugin for showing matching parens " Vim plugin for showing matching parens
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2018 Jun 23 " Last Change: 2018 Jul 3
" Exit quickly when: " Exit quickly when:
" - this plugin was already loaded (or disabled) " - this plugin was already loaded (or disabled)
@@ -103,18 +103,28 @@ function! s:Highlight_Matching_Pair()
call cursor(c_lnum, c_col - before) call cursor(c_lnum, c_col - before)
endif endif
" Build an expression that detects whether the current cursor position is in if !has("syntax") || !exists("g:syntax_on")
" certain syntax types (string, comment, etc.), for use as searchpairpos()'s let s_skip = "0"
" skip argument. else
" Build an expression that detects whether the current cursor position is
" in certain syntax types (string, comment, etc.), for use as
" searchpairpos()'s skip argument.
" We match "escape" for special items, such as lispEscapeSpecial. " We match "escape" for special items, such as lispEscapeSpecial.
let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' . let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
\ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))' \ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))'
" If executing the expression determines that the cursor is currently in " If executing the expression determines that the cursor is currently in
" one of the syntax types, then we want searchpairpos() to find the pair " one of the syntax types, then we want searchpairpos() to find the pair
" within those syntax types (i.e., not skip). Otherwise, the cursor is " within those syntax types (i.e., not skip). Otherwise, the cursor is
" outside of the syntax types and s_skip should keep its value so we skip any " outside of the syntax types and s_skip should keep its value so we skip
" matching pair inside the syntax types. " any matching pair inside the syntax types.
execute 'if' s_skip '| let s_skip = 0 | endif' " Catch if this throws E363: pattern uses more memory than 'maxmempattern'.
try
execute 'if ' . s_skip . ' | let s_skip = "0" | endif'
catch /^Vim\%((\a\+)\)\=:E363/
" We won't find anything, so skip searching, should keep Vim responsive.
return
endtry
endif
" Limit the search to lines visible in the window. " Limit the search to lines visible in the window.
let stoplinebottom = line('w$') let stoplinebottom = line('w$')