aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-11-14 11:27:17 +0100
committerGitHub <noreply@github.com>2018-11-14 11:27:17 +0100
commite14fa8569cea4164bb4953a0368a94686fbd47e5 (patch)
treed40f53b598f1c249a606fb2e98b331ec0f9d9533
parent05f9c7c2f7f52a5b4b1a72a49dab99dc21195c7d (diff)
parentf6c6567cb1bbc14750e487907b19eb59ce79434c (diff)
downloadrneovim-e14fa8569cea4164bb4953a0368a94686fbd47e5.tar.gz
rneovim-e14fa8569cea4164bb4953a0368a94686fbd47e5.tar.bz2
rneovim-e14fa8569cea4164bb4953a0368a94686fbd47e5.zip
Merge #9231 'vim-patch:8.1.{115,143,311,352}'
-rw-r--r--runtime/autoload/tar.vim34
-rw-r--r--runtime/pack/dist/opt/cfilter/plugin/cfilter.vim43
-rw-r--r--runtime/plugin/matchit.vim12
-rw-r--r--runtime/plugin/matchparen.vim34
4 files changed, 97 insertions, 26 deletions
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index d92fe1b180..dc670dbd14 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -153,15 +153,14 @@ fun! tar#Browse(tarfile)
let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
endif
- let gzip_command = s:get_gzip_command(tarfile)
-
let curlast= line("$")
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." - ")
exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif tarfile =~# '\.lrp'
" 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\)$'
" 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." - "
@@ -291,17 +290,16 @@ fun! tar#Read(fname,mode)
let tar_secure= " "
endif
- let gzip_command = s:get_gzip_command(tarfile)
-
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)
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\)$'
+ 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))
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$'
" 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$'
" 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
@@ -589,8 +587,9 @@ fun! tar#Vimuntar(...)
" if necessary, decompress the tarball; then, extract it
if tartail =~ '\.tgz'
- if executable("bzip2")
- silent exe "!bzip2 -d ".shellescape(tartail)
+ let gzip_command = s:get_gzip_command(tarfile)
+ if executable(gzip_command)
+ silent exe "!" . gzip_command . " -d ".shellescape(tartail)
elseif executable("gunzip")
silent exe "!gunzip ".shellescape(tartail)
elseif executable("gzip")
@@ -630,11 +629,24 @@ fun! tar#Vimuntar(...)
endfun
func s:get_gzip_command(file)
- if a:file =~# 'z$' && executable('bzip2')
- " Some .tgz files are actually compressed with bzip2. Since bzip2 can
- " handle the format from gzip, use it if the command exists.
+ " Try using the "file" command to get the actual compression type, since
+ " there is no standard way for the naming: ".tgz", ".tbz", ".txz", etc.
+ " 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'
+ 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'
endfunc
diff --git a/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim b/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim
new file mode 100644
index 0000000000..7a6464fc98
--- /dev/null
+++ b/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim
@@ -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>)
diff --git a/runtime/plugin/matchit.vim b/runtime/plugin/matchit.vim
index e3171e5cbb..3b0a8112dc 100644
--- a/runtime/plugin/matchit.vim
+++ b/runtime/plugin/matchit.vim
@@ -1,5 +1,5 @@
" 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>
" Version: 1.13.3, for Vim 6.3+
" Fix from Tommy Allen included.
@@ -268,7 +268,7 @@ function! s:Match_wrapper(word, forward, mode) range
" execute "normal!" . curcol . "l"
" endif
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
- let skip = "0"
+ let skip = '0'
else
execute "if " . skip . "| let skip = '0' | endif"
endif
@@ -708,10 +708,16 @@ fun! s:MultiMatch(spflag, mode)
let openpat = substitute(openpat, ',', '\\|', 'g')
let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g')
let closepat = substitute(closepat, ',', '\\|', 'g')
+
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
let skip = '0'
else
- execute "if " . skip . "| let skip = '0' | endif"
+ try
+ 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
mark '
let level = v:count1
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim
index 23d4beea87..65b9fe57bf 100644
--- a/runtime/plugin/matchparen.vim
+++ b/runtime/plugin/matchparen.vim
@@ -1,6 +1,6 @@
" Vim plugin for showing matching parens
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2018 Jun 23
+" Last Change: 2018 Jul 3
" Exit quickly when:
" - this plugin was already loaded (or disabled)
@@ -103,18 +103,28 @@ function! s:Highlight_Matching_Pair()
call cursor(c_lnum, c_col - before)
endif
- " 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.
- let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
+ if !has("syntax") || !exists("g:syntax_on")
+ let s_skip = "0"
+ 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.
+ let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
\ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))'
- " If executing the expression determines that the cursor is currently in
- " 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
- " outside of the syntax types and s_skip should keep its value so we skip any
- " matching pair inside the syntax types.
- execute 'if' s_skip '| let s_skip = 0 | endif'
+ " If executing the expression determines that the cursor is currently in
+ " 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
+ " outside of the syntax types and s_skip should keep its value so we skip
+ " any matching pair inside the syntax types.
+ " 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.
let stoplinebottom = line('w$')