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:
Jim Zhou
2025-02-28 18:06:14 +01:00
committed by Christian Brabandt
parent a2c5559f29
commit 56957ed410
7 changed files with 89 additions and 44 deletions

View File

@ -1,6 +1,6 @@
" Vim plugin for editing compressed files.
" 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>
" Exit quickly when:
@ -20,11 +20,12 @@ augroup gzip
" The functions are defined in autoload/gzip.vim.
"
" 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.
autocmd BufReadPost,FileReadPost *.br call gzip#read("brotli -d --rm")
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 *.lz call gzip#read("lzip -d")
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 *.bz2 call gzip#write("bzip2")
autocmd BufWritePost,FileWritePost *.bz3 call gzip#write("bzip3")
autocmd BufWritePost,FileWritePost *.gz call gzip#write("gzip")
autocmd BufWritePost,FileWritePost *.lz call gzip#write("lzip")
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 *.bz2 call gzip#appre("bzip2 -d")
autocmd FileAppendPre *.bz3 call gzip#appre("bzip3 -d")
autocmd FileAppendPre *.gz call gzip#appre("gzip -dn")
autocmd FileAppendPre *.lz call gzip#appre("lzip -d")
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 *.bz2 call gzip#write("bzip2")
autocmd FileAppendPost *.bz3 call gzip#write("bzip3")
autocmd FileAppendPost *.gz call gzip#write("gzip")
autocmd FileAppendPost *.lz call gzip#write("lzip")
autocmd FileAppendPost *.lz4 call gzip#write("lz4 --rm")

View File

@ -38,6 +38,7 @@ augroup tar
au BufReadCmd *.lrp 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.bz3 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.lzma call tar#Browse(expand("<amatch>"))

View File

@ -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()
augroup Vimball
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' |
\ 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
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 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' |
\ 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
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
augroup END