Mercurial > vim
comparison runtime/autoload/tar.vim @ 23047:29c5f168c6fd
Update runtime files
Commit: https://github.com/vim/vim/commit/23515b4ef7580af8b9d3b964a558ab2007cacda5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 29 14:36:24 2020 +0100
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 29 Nov 2020 14:45:04 +0100 |
parents | 9b7f90e56753 |
children | 11b656e74444 |
comparison
equal
deleted
inserted
replaced
23046:9a30b28b8154 | 23047:29c5f168c6fd |
---|---|
161 | 161 |
162 if tarfile =~# '\.\(gz\)$' | 162 if tarfile =~# '\.\(gz\)$' |
163 " call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") | 163 " call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") |
164 exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " | 164 exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " |
165 | 165 |
166 elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' | 166 elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' || tarfile =~# '\.\(tzs\)$' |
167 if has("unix") && executable("file") | 167 if has("unix") && executable("file") |
168 let filekind= system("file ".shellescape(tarfile,1)) =~ "bzip2" | 168 let filekind= system("file ".shellescape(tarfile,1)) =~ "bzip2" |
169 else | 169 else |
170 let filekind= "" | 170 let filekind= "" |
171 endif | 171 endif |
172 | 172 |
173 if filekind =~ "bzip2" | 173 if filekind =~ "bzip2" |
174 exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " | 174 exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " |
175 elseif filekind =~ "XZ" | 175 elseif filekind =~ "XZ" |
176 exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " | 176 exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " |
177 elseif filekind =~ "Zstandard" | |
178 exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " | |
177 else | 179 else |
178 exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " | 180 exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " |
179 endif | 181 endif |
180 | 182 |
181 elseif tarfile =~# '\.lrp' | 183 elseif tarfile =~# '\.lrp' |
188 " call Decho("3: exe silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") | 190 " call Decho("3: exe silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") |
189 exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " | 191 exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " |
190 elseif tarfile =~# '\.\(xz\|txz\)$' | 192 elseif tarfile =~# '\.\(xz\|txz\)$' |
191 " call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") | 193 " call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") |
192 exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " | 194 exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " |
195 elseif tarfile =~# '\.\(zst\|tzs\)$' | |
196 exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " | |
193 else | 197 else |
194 if tarfile =~ '^\s*-' | 198 if tarfile =~ '^\s*-' |
195 " A file name starting with a dash is taken as an option. Prepend ./ to avoid that. | 199 " A file name starting with a dash is taken as an option. Prepend ./ to avoid that. |
196 let tarfile = substitute(tarfile, '-', './-', '') | 200 let tarfile = substitute(tarfile, '-', './-', '') |
197 endif | 201 endif |
300 let decmp= "|lzcat" | 304 let decmp= "|lzcat" |
301 let doro = 1 | 305 let doro = 1 |
302 elseif fname =~ '\.xz$' && executable("xzcat") | 306 elseif fname =~ '\.xz$' && executable("xzcat") |
303 let decmp= "|xzcat" | 307 let decmp= "|xzcat" |
304 let doro = 1 | 308 let doro = 1 |
309 elseif fname =~ '\.zst$' && executable("zstdcat") | |
310 let decmp= "|zstdcat" | |
311 let doro = 1 | |
305 else | 312 else |
306 let decmp="" | 313 let decmp="" |
307 let doro = 0 | 314 let doro = 0 |
308 if fname =~ '\.bz2$\|\.gz$\|\.lzma$\|\.xz$\|\.zip$\|\.Z$' | 315 if fname =~ '\.bz2$\|\.gz$\|\.lzma$\|\.xz$\|\.zip$\|\.Z$' |
309 setlocal bin | 316 setlocal bin |
329 endif | 336 endif |
330 if filekind =~ "bzip2" | 337 if filekind =~ "bzip2" |
331 exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp | 338 exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp |
332 elseif filekind =~ "XZ" | 339 elseif filekind =~ "XZ" |
333 exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp | 340 exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp |
341 elseif filekind =~ "Zstandard" | |
342 exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp | |
334 else | 343 else |
335 exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp | 344 exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp |
336 endif | 345 endif |
337 | 346 |
338 elseif tarfile =~# '\.lrp$' | 347 elseif tarfile =~# '\.lrp$' |
450 elseif tarfile =~# '\.xz' | 459 elseif tarfile =~# '\.xz' |
451 call system("xz -d -- ".shellescape(tarfile,0)) | 460 call system("xz -d -- ".shellescape(tarfile,0)) |
452 let tarfile = substitute(tarfile,'\.xz','','e') | 461 let tarfile = substitute(tarfile,'\.xz','','e') |
453 let compress= "xz -- ".shellescape(tarfile,0) | 462 let compress= "xz -- ".shellescape(tarfile,0) |
454 " call Decho("compress<".compress.">") | 463 " call Decho("compress<".compress.">") |
464 elseif tarfile =~# '\.zst' | |
465 call system("zstd --decompress -- ".shellescape(tarfile,0)) | |
466 let tarfile = substitute(tarfile,'\.zst','','e') | |
467 let compress= "zstd -- ".shellescape(tarfile,0) | |
455 elseif tarfile =~# '\.lzma' | 468 elseif tarfile =~# '\.lzma' |
456 call system("lzma -d -- ".shellescape(tarfile,0)) | 469 call system("lzma -d -- ".shellescape(tarfile,0)) |
457 let tarfile = substitute(tarfile,'\.lzma','','e') | 470 let tarfile = substitute(tarfile,'\.lzma','','e') |
458 let compress= "lzma -- ".shellescape(tarfile,0) | 471 let compress= "lzma -- ".shellescape(tarfile,0) |
459 " call Decho("compress<".compress.">") | 472 " call Decho("compress<".compress.">") |
674 echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!" | echohl NONE | 687 echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!" | echohl NONE |
675 " call Decho("***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!") | 688 " call Decho("***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!") |
676 else | 689 else |
677 echo "***note*** successfully extracted ".fname | 690 echo "***note*** successfully extracted ".fname |
678 endif | 691 endif |
692 | |
693 elseif filereadable(tarbase.".tzs") | |
694 let extractcmd= substitute(extractcmd,"-","--zstd","") | |
695 " call Decho("system(".extractcmd." ".shellescape(tarbase).".tzs ".shellescape(fname).")") | |
696 call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname)) | |
697 if v:shell_error != 0 | |
698 echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!" | echohl NONE | |
699 " call Decho("***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!") | |
700 else | |
701 echo "***note*** successfully extracted ".fname | |
702 endif | |
703 | |
704 elseif filereadable(tarbase.".tar.zst") | |
705 let extractcmd= substitute(extractcmd,"-","--zstd","") | |
706 " call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.zst ".shellescape(fname).")") | |
707 call system(extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname)) | |
708 if v:shell_error != 0 | |
709 echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!" | echohl NONE | |
710 " call Decho("***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!") | |
711 else | |
712 echo "***note*** successfully extracted ".fname | |
713 endif | |
679 endif | 714 endif |
680 | 715 |
681 " restore option | 716 " restore option |
682 let &report= repkeep | 717 let &report= repkeep |
683 | 718 |