mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
runtime(misc): add support for bzip3 to tar, vimball and gzip plugins
fixes: #16751 closes: #16755 Signed-off-by: Jim Zhou <jimzhouzzy@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
a2c5559f29
commit
56957ed410
@@ -12,6 +12,7 @@
|
|||||||
" autoloading search path fix
|
" autoloading search path fix
|
||||||
" substitution of hardcoded commands with global variables
|
" substitution of hardcoded commands with global variables
|
||||||
" 2024 Nov 12 by Vim Project: fix problems on Windows (#16036)
|
" 2024 Nov 12 by Vim Project: fix problems on Windows (#16036)
|
||||||
|
" 2025 Feb 28 by Vim Project: add support for bzip3 (#16755)
|
||||||
" }}}
|
" }}}
|
||||||
"
|
"
|
||||||
" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
|
" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
|
||||||
@@ -100,6 +101,10 @@ if !exists("g:GetLatestVimScripts_bunzip2")
|
|||||||
let g:GetLatestVimScripts_bunzip2= "bunzip2"
|
let g:GetLatestVimScripts_bunzip2= "bunzip2"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists("g:GetLatestVimScripts_bunzip3")
|
||||||
|
let g:GetLatestVimScripts_bunzip3= "bunzip3"
|
||||||
|
endif
|
||||||
|
|
||||||
if !exists("g:GetLatestVimScripts_gunzip")
|
if !exists("g:GetLatestVimScripts_gunzip")
|
||||||
let g:GetLatestVimScripts_gunzip= "gunzip"
|
let g:GetLatestVimScripts_gunzip= "gunzip"
|
||||||
endif
|
endif
|
||||||
@@ -565,73 +570,55 @@ fun! s:GetOneScript(...)
|
|||||||
" --------------------------------------------------------------------------
|
" --------------------------------------------------------------------------
|
||||||
" call Decho("checking if plugin requested autoinstall: doautoinstall=".doautoinstall)
|
" call Decho("checking if plugin requested autoinstall: doautoinstall=".doautoinstall)
|
||||||
if doautoinstall
|
if doautoinstall
|
||||||
" call Decho(" ")
|
|
||||||
" call Decho("Autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname))
|
|
||||||
if filereadable(sname)
|
if filereadable(sname)
|
||||||
" call Decho("<".sname."> is readable")
|
|
||||||
" call Decho("exe silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall))
|
|
||||||
exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall)
|
exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall)
|
||||||
let curdir = fnameescape(substitute(getcwd(),'\','/','ge'))
|
let curdir = fnameescape(substitute(getcwd(),'\','/','ge'))
|
||||||
let installdir= curdir."/Installed"
|
let installdir= curdir."/Installed"
|
||||||
if !isdirectory(installdir)
|
if !isdirectory(installdir)
|
||||||
call mkdir(installdir)
|
call mkdir(installdir)
|
||||||
endif
|
endif
|
||||||
" call Decho("curdir<".curdir."> installdir<".installdir.">")
|
|
||||||
" call Decho("exe cd ".fnameescape(s:autoinstall))
|
|
||||||
exe "cd ".fnameescape(s:autoinstall)
|
exe "cd ".fnameescape(s:autoinstall)
|
||||||
|
|
||||||
" determine target directory for moves
|
" determine target directory for moves
|
||||||
let firstdir= substitute(&rtp,',.*$','','')
|
let firstdir= substitute(&rtp,',.*$','','')
|
||||||
let pname = substitute(sname,'\..*','.vim','')
|
let pname = substitute(sname,'\..*','.vim','')
|
||||||
" call Decho("determine tgtdir: is <".firstdir.'/AsNeeded/'.pname." readable?")
|
|
||||||
if filereadable(firstdir.'/AsNeeded/'.pname)
|
if filereadable(firstdir.'/AsNeeded/'.pname)
|
||||||
let tgtdir= "AsNeeded"
|
let tgtdir= "AsNeeded"
|
||||||
else
|
else
|
||||||
let tgtdir= "plugin"
|
let tgtdir= "plugin"
|
||||||
endif
|
endif
|
||||||
" call Decho("tgtdir<".tgtdir."> pname<".pname.">")
|
|
||||||
|
|
||||||
" decompress
|
" decompress
|
||||||
if sname =~ '\.bz2$'
|
if sname =~ '\.bz2$'
|
||||||
" call Decho("decompress: attempt to bunzip2 ".sname)
|
|
||||||
exe "sil !".g:GetLatestVimScripts_bunzip2." ".shellescape(sname)
|
exe "sil !".g:GetLatestVimScripts_bunzip2." ".shellescape(sname)
|
||||||
let sname= substitute(sname,'\.bz2$','','')
|
let sname= substitute(sname,'\.bz2$','','')
|
||||||
" call Decho("decompress: new sname<".sname."> after bunzip2")
|
elseif sname =~ '\.bz3$'
|
||||||
|
exe "sil !".g:GetLatestVimScripts_bunzip3." ".shellescape(sname)
|
||||||
|
let sname= substitute(sname,'\.bz3$','','')
|
||||||
elseif sname =~ '\.gz$'
|
elseif sname =~ '\.gz$'
|
||||||
" call Decho("decompress: attempt to gunzip ".sname)
|
|
||||||
exe "sil !".g:GetLatestVimScripts_gunzip." ".shellescape(sname)
|
exe "sil !".g:GetLatestVimScripts_gunzip." ".shellescape(sname)
|
||||||
let sname= substitute(sname,'\.gz$','','')
|
let sname= substitute(sname,'\.gz$','','')
|
||||||
" call Decho("decompress: new sname<".sname."> after gunzip")
|
|
||||||
elseif sname =~ '\.xz$'
|
elseif sname =~ '\.xz$'
|
||||||
" call Decho("decompress: attempt to unxz ".sname)
|
|
||||||
exe "sil !".g:GetLatestVimScripts_unxz." ".shellescape(sname)
|
exe "sil !".g:GetLatestVimScripts_unxz." ".shellescape(sname)
|
||||||
let sname= substitute(sname,'\.xz$','','')
|
let sname= substitute(sname,'\.xz$','','')
|
||||||
" call Decho("decompress: new sname<".sname."> after unxz")
|
|
||||||
else
|
else
|
||||||
" call Decho("no decompression needed")
|
" call Decho("no decompression needed")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" distribute archive(.zip, .tar, .vba, .vmb, ...) contents
|
" distribute archive(.zip, .tar, .vba, .vmb, ...) contents
|
||||||
if sname =~ '\.zip$'
|
if sname =~ '\.zip$'
|
||||||
" call Decho("dearchive: attempt to unzip ".sname)
|
|
||||||
exe "silent !".g:GetLatestVimScripts_unzip." -o ".shellescape(sname)
|
exe "silent !".g:GetLatestVimScripts_unzip." -o ".shellescape(sname)
|
||||||
elseif sname =~ '\.tar$'
|
elseif sname =~ '\.tar$'
|
||||||
" call Decho("dearchive: attempt to untar ".sname)
|
|
||||||
exe "silent !tar -xvf ".shellescape(sname)
|
exe "silent !tar -xvf ".shellescape(sname)
|
||||||
elseif sname =~ '\.tgz$'
|
elseif sname =~ '\.tgz$'
|
||||||
" call Decho("dearchive: attempt to untar+gunzip ".sname)
|
|
||||||
exe "silent !tar -zxvf ".shellescape(sname)
|
exe "silent !tar -zxvf ".shellescape(sname)
|
||||||
elseif sname =~ '\.taz$'
|
elseif sname =~ '\.taz$'
|
||||||
" call Decho("dearchive: attempt to untar+uncompress ".sname)
|
|
||||||
exe "silent !tar -Zxvf ".shellescape(sname)
|
exe "silent !tar -Zxvf ".shellescape(sname)
|
||||||
elseif sname =~ '\.tbz$'
|
elseif sname =~ '\.tbz$'
|
||||||
" call Decho("dearchive: attempt to untar+bunzip2 ".sname)
|
|
||||||
exe "silent !tar -jxvf ".shellescape(sname)
|
exe "silent !tar -jxvf ".shellescape(sname)
|
||||||
elseif sname =~ '\.txz$'
|
elseif sname =~ '\.txz$'
|
||||||
" call Decho("dearchive: attempt to untar+xz ".sname)
|
|
||||||
exe "silent !tar -Jxvf ".shellescape(sname)
|
exe "silent !tar -Jxvf ".shellescape(sname)
|
||||||
elseif sname =~ '\.vba$\|\.vmb$'
|
elseif sname =~ '\.vba$\|\.vmb$'
|
||||||
" call Decho("dearchive: attempt to handle a vimball: ".sname)
|
|
||||||
silent 1split
|
silent 1split
|
||||||
if exists("g:vimball_home")
|
if exists("g:vimball_home")
|
||||||
let oldvimballhome= g:vimball_home
|
let oldvimballhome= g:vimball_home
|
||||||
@@ -648,25 +635,21 @@ fun! s:GetOneScript(...)
|
|||||||
else
|
else
|
||||||
" call Decho("no dearchiving needed")
|
" call Decho("no dearchiving needed")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" ---------------------------------------------
|
" ---------------------------------------------
|
||||||
" move plugin to plugin/ or AsNeeded/ directory
|
" move plugin to plugin/ or AsNeeded/ directory
|
||||||
" ---------------------------------------------
|
" ---------------------------------------------
|
||||||
if sname =~ '.vim$'
|
if sname =~ '.vim$'
|
||||||
" call Decho("dearchive: attempt to simply move ".sname." to ".tgtdir)
|
|
||||||
exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".tgtdir
|
exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".tgtdir
|
||||||
else
|
else
|
||||||
" call Decho("dearchive: move <".sname."> to installdir<".installdir.">")
|
|
||||||
exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".installdir
|
exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".installdir
|
||||||
endif
|
endif
|
||||||
if tgtdir != "plugin"
|
if tgtdir != "plugin"
|
||||||
" call Decho("exe silent !".g:GetLatestVimScripts_mv." ".shellescape("plugin/".pname)." ".tgtdir)
|
|
||||||
exe "silent !".g:GetLatestVimScripts_mv." ".shellescape("plugin/".pname)." ".tgtdir
|
exe "silent !".g:GetLatestVimScripts_mv." ".shellescape("plugin/".pname)." ".tgtdir
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" helptags step
|
" helptags step
|
||||||
let docdir= substitute(&rtp,',.*','','e')."/doc"
|
let docdir= substitute(&rtp,',.*','','e')."/doc"
|
||||||
" call Decho("helptags: docdir<".docdir.">")
|
|
||||||
exe "helptags ".fnameescape(docdir)
|
exe "helptags ".fnameescape(docdir)
|
||||||
exe "cd ".fnameescape(curdir)
|
exe "cd ".fnameescape(curdir)
|
||||||
endif
|
endif
|
||||||
@@ -681,13 +664,8 @@ fun! s:GetOneScript(...)
|
|||||||
|
|
||||||
" update the data in the <GetLatestVimScripts.dat> file
|
" update the data in the <GetLatestVimScripts.dat> file
|
||||||
call setline(line("."),modline)
|
call setline(line("."),modline)
|
||||||
" call Decho("update data in ".expand("%")."#".line(".").": modline<".modline.">")
|
|
||||||
" else " Decho
|
|
||||||
" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."], no need to update")
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" call Dredir("BUFFER TEST (GetOneScript)","ls!")
|
|
||||||
" call Dret("GetOneScript")
|
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
|
@@ -1,9 +1,15 @@
|
|||||||
" tar.vim: Handles browsing tarfiles - AUTOLOAD PORTION
|
" tar.vim: Handles browsing tarfiles - AUTOLOAD PORTION
|
||||||
" Date: Feb 06, 2025
|
" Date: Feb 28, 2025
|
||||||
" Version: 32b (with modifications from the Vim Project)
|
" Version: 32b (with modifications from the Vim Project)
|
||||||
" Maintainer: This runtime file is looking for a new maintainer.
|
" Maintainer: This runtime file is looking for a new maintainer.
|
||||||
" Former Maintainer: Charles E Campbell
|
" Former Maintainer: Charles E Campbell
|
||||||
" License: Vim License (see vim's :help license)
|
" License: Vim License (see vim's :help license)
|
||||||
|
" Last Change:
|
||||||
|
" 2024 Jan 08 by Vim Project: fix a few problems (#138331, #12637, #8109)
|
||||||
|
" 2024 Feb 19 by Vim Project: announce adoption
|
||||||
|
" 2024 Nov 11 by Vim Project: support permissions (#7379)
|
||||||
|
" 2025 Feb 06 by Vim Project: add support for lz4 (#16591)
|
||||||
|
" 2025 Feb 28 by Vim Project: add support for bzip3 (#16755)
|
||||||
"
|
"
|
||||||
" Contains many ideas from Michael Toren's <tar.vim>
|
" Contains many ideas from Michael Toren's <tar.vim>
|
||||||
"
|
"
|
||||||
@@ -161,6 +167,8 @@ fun! tar#Browse(tarfile)
|
|||||||
|
|
||||||
if filekind =~ "bzip2"
|
if filekind =~ "bzip2"
|
||||||
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." - "
|
||||||
|
elseif filekind =~ "bzip3"
|
||||||
|
exe "sil! r! bzip3 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
|
||||||
elseif filekind =~ "XZ"
|
elseif filekind =~ "XZ"
|
||||||
exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
|
exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
|
||||||
elseif filekind =~ "Zstandard"
|
elseif filekind =~ "Zstandard"
|
||||||
@@ -175,6 +183,8 @@ fun! tar#Browse(tarfile)
|
|||||||
exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -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\)$'
|
||||||
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." - "
|
||||||
|
elseif tarfile =~# '\.\(bz3\|tb3\)$'
|
||||||
|
exe "sil! r! bzip3 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
|
||||||
elseif tarfile =~# '\.\(lzma\|tlz\)$'
|
elseif tarfile =~# '\.\(lzma\|tlz\)$'
|
||||||
exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
|
exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
|
||||||
elseif tarfile =~# '\.\(xz\|txz\)$'
|
elseif tarfile =~# '\.\(xz\|txz\)$'
|
||||||
@@ -316,6 +326,9 @@ fun! tar#Read(fname,mode)
|
|||||||
if fname =~ '\.bz2$' && executable("bzcat")
|
if fname =~ '\.bz2$' && executable("bzcat")
|
||||||
let decmp= "|bzcat"
|
let decmp= "|bzcat"
|
||||||
let doro = 1
|
let doro = 1
|
||||||
|
elseif fname =~ '\.bz3$' && executable("bz3cat")
|
||||||
|
let decmp= "|bz3cat"
|
||||||
|
let doro = 1
|
||||||
elseif fname =~ '\.t\=gz$' && executable("zcat")
|
elseif fname =~ '\.t\=gz$' && executable("zcat")
|
||||||
let decmp= "|zcat"
|
let decmp= "|zcat"
|
||||||
let doro = 1
|
let doro = 1
|
||||||
@@ -334,7 +347,7 @@ fun! tar#Read(fname,mode)
|
|||||||
else
|
else
|
||||||
let decmp=""
|
let decmp=""
|
||||||
let doro = 0
|
let doro = 0
|
||||||
if fname =~ '\.bz2$\|\.gz$\|\.lzma$\|\.xz$\|\.zip$\|\.Z$'
|
if fname =~ '\.bz2$\|\.bz3$\|\.gz$\|\.lzma$\|\.xz$\|\.zip$\|\.Z$'
|
||||||
setlocal bin
|
setlocal bin
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -348,6 +361,9 @@ fun! tar#Read(fname,mode)
|
|||||||
if tarfile =~# '\.bz2$'
|
if tarfile =~# '\.bz2$'
|
||||||
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
|
||||||
exe "read ".fname
|
exe "read ".fname
|
||||||
|
if tarfile =~# '\.bz3$'
|
||||||
|
exe "sil! r! bzip3 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
|
||||||
|
exe "read ".fname
|
||||||
elseif tarfile =~# '\.\(gz\)$'
|
elseif tarfile =~# '\.\(gz\)$'
|
||||||
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
|
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
|
||||||
exe "read ".fname
|
exe "read ".fname
|
||||||
@@ -360,6 +376,9 @@ fun! tar#Read(fname,mode)
|
|||||||
if filekind =~ "bzip2"
|
if filekind =~ "bzip2"
|
||||||
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
|
||||||
exe "read ".fname
|
exe "read ".fname
|
||||||
|
elseif filekind =~ "bzip3"
|
||||||
|
exe "sil! r! bzip3 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
|
||||||
|
exe "read ".fname
|
||||||
elseif filekind =~ "XZ"
|
elseif filekind =~ "XZ"
|
||||||
exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
|
exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
|
||||||
exe "read ".fname
|
exe "read ".fname
|
||||||
@@ -446,6 +465,10 @@ fun! tar#Write(fname)
|
|||||||
call system("bzip2 -d -- ".shellescape(tarfile,0))
|
call system("bzip2 -d -- ".shellescape(tarfile,0))
|
||||||
let tarfile = substitute(tarfile,'\.bz2','','e')
|
let tarfile = substitute(tarfile,'\.bz2','','e')
|
||||||
let compress= "bzip2 -- ".shellescape(tarfile,0)
|
let compress= "bzip2 -- ".shellescape(tarfile,0)
|
||||||
|
elseif tarfile =~# '\.bz3'
|
||||||
|
call system("bzip3 -d -- ".shellescape(tarfile,0))
|
||||||
|
let tarfile = substitute(tarfile,'\.bz3','','e')
|
||||||
|
let compress= "bzip3 -- ".shellescape(tarfile,0)
|
||||||
elseif tarfile =~# '\.gz'
|
elseif tarfile =~# '\.gz'
|
||||||
call system("gzip -d -- ".shellescape(tarfile,0))
|
call system("gzip -d -- ".shellescape(tarfile,0))
|
||||||
let tarfile = substitute(tarfile,'\.gz','','e')
|
let tarfile = substitute(tarfile,'\.gz','','e')
|
||||||
@@ -638,6 +661,15 @@ fun! tar#Extract()
|
|||||||
echo "***note*** successfully extracted ".fname
|
echo "***note*** successfully extracted ".fname
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
elseif filereadable(tarbase.".tar.bz3")
|
||||||
|
let extractcmd= substitute(extractcmd,"-","-j","")
|
||||||
|
call system(extractcmd." ".shellescape(tarbase).".tar.bz3 ".shellescape(fname))
|
||||||
|
if v:shell_error != 0
|
||||||
|
echohl Error | echo "***error*** ".extractcmd."j ".tarbase.".tar.bz3 ".fname.": failed!" | echohl NONE
|
||||||
|
else
|
||||||
|
echo "***note*** successfully extracted ".fname
|
||||||
|
endif
|
||||||
|
|
||||||
elseif filereadable(tarbase.".txz")
|
elseif filereadable(tarbase.".txz")
|
||||||
let extractcmd= substitute(extractcmd,"-","-J","")
|
let extractcmd= substitute(extractcmd,"-","-J","")
|
||||||
call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname))
|
call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname))
|
||||||
|
@@ -2,8 +2,10 @@
|
|||||||
" Maintainer: This runtime file is looking for a new maintainer.
|
" Maintainer: This runtime file is looking for a new maintainer.
|
||||||
" Original Author: Charles E. Campbell
|
" Original Author: Charles E. Campbell
|
||||||
" Date: Apr 11, 2016
|
" Date: Apr 11, 2016
|
||||||
" Version: 37
|
" Version: 37 (with modifications from the Vim Project)
|
||||||
" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
|
" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
|
||||||
|
" Last Change:
|
||||||
|
" 2025 Feb 28 by Vim Project: add support for bzip3 (#16755)
|
||||||
" Copyright: (c) 2004-2011 by Charles E. Campbell
|
" Copyright: (c) 2004-2011 by Charles E. Campbell
|
||||||
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
||||||
" (see |copyright|) except use "Vimball" instead of "Vim".
|
" (see |copyright|) except use "Vimball" instead of "Vim".
|
||||||
@@ -530,6 +532,26 @@ fun! vimball#Decompress(fname,...)
|
|||||||
exe "e ".escape(fname,' \')
|
exe "e ".escape(fname,' \')
|
||||||
if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
|
if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
|
||||||
|
|
||||||
|
elseif expand("%") =~ '.*\.bz3' && executable("bunzip3")
|
||||||
|
" handle *.bz3 with bunzip3
|
||||||
|
silent exe "!bunzip3 ".shellescape(a:fname)
|
||||||
|
if v:shell_error != 0
|
||||||
|
call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) bunzip3 may have failed with <".a:fname.">")
|
||||||
|
endif
|
||||||
|
let fname= substitute(a:fname,'\.bz3$','','')
|
||||||
|
exe "e ".escape(fname,' \')
|
||||||
|
if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
|
||||||
|
|
||||||
|
elseif expand("%") =~ '.*\.bz3' && executable("bzip3")
|
||||||
|
" handle *.bz3 with bzip3 -d
|
||||||
|
silent exe "!bzip3 -d ".shellescape(a:fname)
|
||||||
|
if v:shell_error != 0
|
||||||
|
call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "bzip3 -d" may have failed with <'.a:fname.">")
|
||||||
|
endif
|
||||||
|
let fname= substitute(a:fname,'\.bz3$','','')
|
||||||
|
exe "e ".escape(fname,' \')
|
||||||
|
if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
|
||||||
|
|
||||||
elseif expand("%") =~ '.*\.zip' && executable("unzip")
|
elseif expand("%") =~ '.*\.zip' && executable("unzip")
|
||||||
" handle *.zip with unzip
|
" handle *.zip with unzip
|
||||||
silent exe "!unzip ".shellescape(a:fname)
|
silent exe "!unzip ".shellescape(a:fname)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
*pi_getscript.txt* For Vim version 9.1. Last change: 2024 Oct 05
|
*pi_getscript.txt* For Vim version 9.1. Last change: 2025 Feb 28
|
||||||
>
|
>
|
||||||
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell
|
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell
|
||||||
<
|
<
|
||||||
@@ -361,6 +361,11 @@ after/syntax/c.vim contained in it to overwrite a user's c.vim.
|
|||||||
< default= bunzip2
|
< default= bunzip2
|
||||||
This variable holds the name of the command to decompress .bz2
|
This variable holds the name of the command to decompress .bz2
|
||||||
files
|
files
|
||||||
|
>
|
||||||
|
g:GetLatestVimScripts_bunzip3
|
||||||
|
< default= bunzip3
|
||||||
|
This variable holds the name of the command to decompress .bz3
|
||||||
|
files
|
||||||
>
|
>
|
||||||
g:GetLatestVimScripts_gunzip
|
g:GetLatestVimScripts_gunzip
|
||||||
< default= gunzip
|
< default= gunzip
|
||||||
@@ -409,6 +414,8 @@ The AutoInstall process will:
|
|||||||
Windows: $HOME\vimfiles
|
Windows: $HOME\vimfiles
|
||||||
if the downloaded file ends with ".bz2"
|
if the downloaded file ends with ".bz2"
|
||||||
bunzip2 it
|
bunzip2 it
|
||||||
|
else if the downloaded file ends with ".bz3"
|
||||||
|
bunzip3 it
|
||||||
else if the downloaded file ends with ".gz"
|
else if the downloaded file ends with ".gz"
|
||||||
gunzip it
|
gunzip it
|
||||||
if the resulting file ends with ".zip"
|
if the resulting file ends with ".zip"
|
||||||
@@ -422,6 +429,7 @@ The AutoInstall process will:
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
|
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
|
||||||
|
|
||||||
|
v38 Feb 25, 2025 : * handles additional decompression option for .bzip3 files.
|
||||||
v37 Sep 23, 2024 : * Support for the new vimball's .vmb extension (old .vba
|
v37 Sep 23, 2024 : * Support for the new vimball's .vmb extension (old .vba
|
||||||
extension conflicted with visual basic).
|
extension conflicted with visual basic).
|
||||||
* Support for |glvs-autoinstall| in ftplugins and packages.
|
* Support for |glvs-autoinstall| in ftplugins and packages.
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
" Vim plugin for editing compressed files.
|
" Vim plugin for editing compressed files.
|
||||||
" Maintainer: The Vim Project <https://github.com/vim/vim>
|
" Maintainer: The Vim Project <https://github.com/vim/vim>
|
||||||
" Last Change: 2025 Feb 06
|
" Last Change: 2025 Feb 28
|
||||||
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
|
|
||||||
" Exit quickly when:
|
" Exit quickly when:
|
||||||
@@ -20,11 +20,12 @@ augroup gzip
|
|||||||
" The functions are defined in autoload/gzip.vim.
|
" The functions are defined in autoload/gzip.vim.
|
||||||
"
|
"
|
||||||
" Set binary mode before reading the file.
|
" Set binary mode before reading the file.
|
||||||
autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma,*.xz,*.lz,*.zst,*.br,*.lzo,*.lz4 setlocal bin
|
autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.bz3,*.Z,*.lzma,*.xz,*.lz,*.zst,*.br,*.lzo,*.lz4 setlocal bin
|
||||||
|
|
||||||
" Use "gzip -d" and similar commands, gunzip isn't always available.
|
" Use "gzip -d" and similar commands, gunzip isn't always available.
|
||||||
autocmd BufReadPost,FileReadPost *.br call gzip#read("brotli -d --rm")
|
autocmd BufReadPost,FileReadPost *.br call gzip#read("brotli -d --rm")
|
||||||
autocmd BufReadPost,FileReadPost *.bz2 call gzip#read("bzip2 -d")
|
autocmd BufReadPost,FileReadPost *.bz2 call gzip#read("bzip2 -d")
|
||||||
|
autocmd BufReadPost,FileReadPost *.bz3 call gzip#read("bzip3 -d")
|
||||||
autocmd BufReadPost,FileReadPost *.gz call gzip#read("gzip -dn")
|
autocmd BufReadPost,FileReadPost *.gz call gzip#read("gzip -dn")
|
||||||
autocmd BufReadPost,FileReadPost *.lz call gzip#read("lzip -d")
|
autocmd BufReadPost,FileReadPost *.lz call gzip#read("lzip -d")
|
||||||
autocmd BufReadPost,FileReadPost *.lz4 call gzip#read("lz4 -d -q --rm")
|
autocmd BufReadPost,FileReadPost *.lz4 call gzip#read("lz4 -d -q --rm")
|
||||||
@@ -36,6 +37,7 @@ augroup gzip
|
|||||||
|
|
||||||
autocmd BufWritePost,FileWritePost *.br call gzip#write("brotli --rm")
|
autocmd BufWritePost,FileWritePost *.br call gzip#write("brotli --rm")
|
||||||
autocmd BufWritePost,FileWritePost *.bz2 call gzip#write("bzip2")
|
autocmd BufWritePost,FileWritePost *.bz2 call gzip#write("bzip2")
|
||||||
|
autocmd BufWritePost,FileWritePost *.bz3 call gzip#write("bzip3")
|
||||||
autocmd BufWritePost,FileWritePost *.gz call gzip#write("gzip")
|
autocmd BufWritePost,FileWritePost *.gz call gzip#write("gzip")
|
||||||
autocmd BufWritePost,FileWritePost *.lz call gzip#write("lzip")
|
autocmd BufWritePost,FileWritePost *.lz call gzip#write("lzip")
|
||||||
autocmd BufWritePost,FileWritePost *.lz4 call gzip#write("lz4 -q --rm")
|
autocmd BufWritePost,FileWritePost *.lz4 call gzip#write("lz4 -q --rm")
|
||||||
@@ -47,6 +49,7 @@ augroup gzip
|
|||||||
|
|
||||||
autocmd FileAppendPre *.br call gzip#appre("brotli -d --rm")
|
autocmd FileAppendPre *.br call gzip#appre("brotli -d --rm")
|
||||||
autocmd FileAppendPre *.bz2 call gzip#appre("bzip2 -d")
|
autocmd FileAppendPre *.bz2 call gzip#appre("bzip2 -d")
|
||||||
|
autocmd FileAppendPre *.bz3 call gzip#appre("bzip3 -d")
|
||||||
autocmd FileAppendPre *.gz call gzip#appre("gzip -dn")
|
autocmd FileAppendPre *.gz call gzip#appre("gzip -dn")
|
||||||
autocmd FileAppendPre *.lz call gzip#appre("lzip -d")
|
autocmd FileAppendPre *.lz call gzip#appre("lzip -d")
|
||||||
autocmd FileAppendPre *.lz4 call gzip#appre("lz4 -d -q --rm")
|
autocmd FileAppendPre *.lz4 call gzip#appre("lz4 -d -q --rm")
|
||||||
@@ -58,6 +61,7 @@ augroup gzip
|
|||||||
|
|
||||||
autocmd FileAppendPost *.br call gzip#write("brotli --rm")
|
autocmd FileAppendPost *.br call gzip#write("brotli --rm")
|
||||||
autocmd FileAppendPost *.bz2 call gzip#write("bzip2")
|
autocmd FileAppendPost *.bz2 call gzip#write("bzip2")
|
||||||
|
autocmd FileAppendPost *.bz3 call gzip#write("bzip3")
|
||||||
autocmd FileAppendPost *.gz call gzip#write("gzip")
|
autocmd FileAppendPost *.gz call gzip#write("gzip")
|
||||||
autocmd FileAppendPost *.lz call gzip#write("lzip")
|
autocmd FileAppendPost *.lz call gzip#write("lzip")
|
||||||
autocmd FileAppendPost *.lz4 call gzip#write("lz4 --rm")
|
autocmd FileAppendPost *.lz4 call gzip#write("lz4 --rm")
|
||||||
|
@@ -38,6 +38,7 @@ augroup tar
|
|||||||
au BufReadCmd *.lrp call tar#Browse(expand("<amatch>"))
|
au BufReadCmd *.lrp call tar#Browse(expand("<amatch>"))
|
||||||
au BufReadCmd *.tar call tar#Browse(expand("<amatch>"))
|
au BufReadCmd *.tar call tar#Browse(expand("<amatch>"))
|
||||||
au BufReadCmd *.tar.bz2 call tar#Browse(expand("<amatch>"))
|
au BufReadCmd *.tar.bz2 call tar#Browse(expand("<amatch>"))
|
||||||
|
au BufReadCmd *.tar.bz3 call tar#Browse(expand("<amatch>"))
|
||||||
au BufReadCmd *.tar.gz call tar#Browse(expand("<amatch>"))
|
au BufReadCmd *.tar.gz call tar#Browse(expand("<amatch>"))
|
||||||
au BufReadCmd *.tar.lz4 call tar#Browse(expand("<amatch>"))
|
au BufReadCmd *.tar.lz4 call tar#Browse(expand("<amatch>"))
|
||||||
au BufReadCmd *.tar.lzma call tar#Browse(expand("<amatch>"))
|
au BufReadCmd *.tar.lzma call tar#Browse(expand("<amatch>"))
|
||||||
|
@@ -29,17 +29,17 @@ com! -nargs=0 VimballList call vimball#Vimball(0)
|
|||||||
com! -nargs=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings()
|
com! -nargs=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings()
|
||||||
augroup Vimball
|
augroup Vimball
|
||||||
au!
|
au!
|
||||||
au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz
|
au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.bz3,*.vba.zip,*.vba.xz
|
||||||
\ if getline(1) =~ '^" Vimball Archiver' |
|
\ if getline(1) =~ '^" Vimball Archiver' |
|
||||||
\ setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0, "Source this file to extract it! (:so %)")|endif |
|
\ setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0, "Source this file to extract it! (:so %)")|endif |
|
||||||
\ endif
|
\ endif
|
||||||
au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif
|
au SourceCmd *.vba.gz,*.vba.bz2,*.vba.bz3,*.vba.zip,*.vba.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif
|
||||||
au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif
|
au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif
|
||||||
au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz
|
au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.bz3,*.vmb.zip,*.vmb.xz
|
||||||
\ if getline(1) =~ '^" Vimball Archiver' |
|
\ if getline(1) =~ '^" Vimball Archiver' |
|
||||||
\ setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif |
|
\ setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif |
|
||||||
\ endif
|
\ endif
|
||||||
au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif
|
au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.bz3,*.vmb.zip,*.vmb.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif
|
||||||
au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif
|
au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user