Mercurial > vim
comparison runtime/autoload/tar.vim @ 14668:34fd018452ed
Update runtime files.
commit https://github.com/vim/vim/commit/20aac6c1126988339611576d425965a25a777658
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 2 21:07:30 2018 +0200
Update runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 02 Sep 2018 21:15:05 +0200 |
parents | 0ecb909e3249 |
children | ba010fa2bcba |
comparison
equal
deleted
inserted
replaced
14667:289d3fac3399 | 14668:34fd018452ed |
---|---|
150 let tarfile= a:tarfile | 150 let tarfile= a:tarfile |
151 if has("win32unix") && executable("cygpath") | 151 if has("win32unix") && executable("cygpath") |
152 " assuming cygwin | 152 " assuming cygwin |
153 let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') | 153 let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') |
154 endif | 154 endif |
155 | |
156 let gzip_command = s:get_gzip_command(tarfile) | |
157 | |
155 let curlast= line("$") | 158 let curlast= line("$") |
156 if tarfile =~# '\.\(gz\|tgz\)$' | 159 if tarfile =~# '\.\(gz\|tgz\)$' |
157 " call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") | 160 " call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") |
158 exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " | 161 exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " |
159 elseif tarfile =~# '\.lrp' | 162 elseif tarfile =~# '\.lrp' |
160 " call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ") | 163 " call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ") |
161 exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - " | 164 exe "sil! r! cat -- ".shellescape(tarfile,1)."|" . gzip_command . " -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - " |
162 elseif tarfile =~# '\.\(bz2\|tbz\|tb2\)$' | 165 elseif tarfile =~# '\.\(bz2\|tbz\|tb2\)$' |
163 " call Decho("3: exe silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") | 166 " call Decho("3: exe silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") |
164 exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " | 167 exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " |
165 elseif tarfile =~# '\.\(lzma\|tlz\)$' | 168 elseif tarfile =~# '\.\(lzma\|tlz\)$' |
166 " call Decho("3: exe silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") | 169 " call Decho("3: exe silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") |
285 if exists("g:tar_secure") | 288 if exists("g:tar_secure") |
286 let tar_secure= " -- " | 289 let tar_secure= " -- " |
287 else | 290 else |
288 let tar_secure= " " | 291 let tar_secure= " " |
289 endif | 292 endif |
293 | |
294 let gzip_command = s:get_gzip_command(tarfile) | |
295 | |
290 if tarfile =~# '\.bz2$' | 296 if tarfile =~# '\.bz2$' |
291 " call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) | 297 " call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) |
292 exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp | 298 exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp |
293 elseif tarfile =~# '\.\(gz\|tgz\)$' | 299 elseif tarfile =~# '\.\(gz\|tgz\)$' |
294 " call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1)) | 300 " call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1)) |
295 exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp | 301 exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp |
296 elseif tarfile =~# '\.lrp$' | 302 elseif tarfile =~# '\.lrp$' |
297 " 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) | 303 " 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) |
298 exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp | 304 exe "sil! r! cat -- ".shellescape(tarfile,1)." | " . gzip_command . " -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp |
299 elseif tarfile =~# '\.lzma$' | 305 elseif tarfile =~# '\.lzma$' |
300 " call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) | 306 " call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) |
301 exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp | 307 exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp |
302 elseif tarfile =~# '\.\(xz\|txz\)$' | 308 elseif tarfile =~# '\.\(xz\|txz\)$' |
303 " call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) | 309 " call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) |
386 cd _ZIPVIM_ | 392 cd _ZIPVIM_ |
387 " call Decho("current directory now: ".getcwd()) | 393 " call Decho("current directory now: ".getcwd()) |
388 | 394 |
389 let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','') | 395 let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','') |
390 let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','') | 396 let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','') |
397 | |
398 let gzip_command = s:get_gzip_command(tarfile) | |
391 | 399 |
392 " handle compressed archives | 400 " handle compressed archives |
393 if tarfile =~# '\.bz2' | 401 if tarfile =~# '\.bz2' |
394 call system("bzip2 -d -- ".shellescape(tarfile,0)) | 402 call system("bzip2 -d -- ".shellescape(tarfile,0)) |
395 let tarfile = substitute(tarfile,'\.bz2','','e') | 403 let tarfile = substitute(tarfile,'\.bz2','','e') |
396 let compress= "bzip2 -- ".shellescape(tarfile,0) | 404 let compress= "bzip2 -- ".shellescape(tarfile,0) |
397 " call Decho("compress<".compress.">") | 405 " call Decho("compress<".compress.">") |
398 elseif tarfile =~# '\.gz' | 406 elseif tarfile =~# '\.gz' |
399 call system("gzip -d -- ".shellescape(tarfile,0)) | 407 call system(gzip_command . " -d -- ".shellescape(tarfile,0)) |
400 let tarfile = substitute(tarfile,'\.gz','','e') | 408 let tarfile = substitute(tarfile,'\.gz','','e') |
401 let compress= "gzip -- ".shellescape(tarfile,0) | 409 let compress= "gzip -- ".shellescape(tarfile,0) |
402 " call Decho("compress<".compress.">") | 410 " call Decho("compress<".compress.">") |
403 elseif tarfile =~# '\.tgz' | 411 elseif tarfile =~# '\.tgz' |
404 call system("gzip -d -- ".shellescape(tarfile,0)) | 412 call system(gzip_command . " -d -- ".shellescape(tarfile,0)) |
405 let tarfile = substitute(tarfile,'\.tgz','.tar','e') | 413 let tarfile = substitute(tarfile,'\.tgz','.tar','e') |
406 let compress= "gzip -- ".shellescape(tarfile,0) | 414 let compress= "gzip -- ".shellescape(tarfile,0) |
407 let tgz = 1 | 415 let tgz = 1 |
408 " call Decho("compress<".compress.">") | 416 " call Decho("compress<".compress.">") |
409 elseif tarfile =~# '\.xz' | 417 elseif tarfile =~# '\.xz' |
579 endif | 587 endif |
580 " call Decho("getcwd<".getcwd().">") | 588 " call Decho("getcwd<".getcwd().">") |
581 | 589 |
582 " if necessary, decompress the tarball; then, extract it | 590 " if necessary, decompress the tarball; then, extract it |
583 if tartail =~ '\.tgz' | 591 if tartail =~ '\.tgz' |
584 if executable("gunzip") | 592 if executable("bzip2") |
593 silent exe "!bzip2 -d ".shellescape(tartail) | |
594 elseif executable("gunzip") | |
585 silent exe "!gunzip ".shellescape(tartail) | 595 silent exe "!gunzip ".shellescape(tartail) |
586 elseif executable("gzip") | 596 elseif executable("gzip") |
587 silent exe "!gzip -d ".shellescape(tartail) | 597 silent exe "!gzip -d ".shellescape(tartail) |
588 else | 598 else |
589 echoerr "unable to decompress<".tartail."> on this sytem" | 599 echoerr "unable to decompress<".tartail."> on this sytem" |
617 endif | 627 endif |
618 | 628 |
619 " call Dret("tar#Vimuntar") | 629 " call Dret("tar#Vimuntar") |
620 endfun | 630 endfun |
621 | 631 |
632 func s:get_gzip_command(file) | |
633 if a:file =~# 'z$' && executable('bzip2') | |
634 " Some .tgz files are actually compressed with bzip2. Since bzip2 can | |
635 " handle the format from gzip, use it if the command exists. | |
636 return 'bzip2' | |
637 endif | |
638 return 'gzip' | |
639 endfunc | |
640 | |
622 " ===================================================================== | 641 " ===================================================================== |
623 " Modelines And Restoration: {{{1 | 642 " Modelines And Restoration: {{{1 |
624 let &cpo= s:keepcpo | 643 let &cpo= s:keepcpo |
625 unlet s:keepcpo | 644 unlet s:keepcpo |
626 " vim:ts=8 fdm=marker | 645 " vim:ts=8 fdm=marker |