diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:09:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:09:20 +0000 |
commit | 029f72b1a93430b24b88eb3a72c6114d9f149737 (patch) | |
tree | 765d5c2041967f9c6fef195fe343d9234a030e90 /runtime/plugin/gzip.vim | |
parent | Initial commit. (diff) | |
download | vim-029f72b1a93430b24b88eb3a72c6114d9f149737.tar.xz vim-029f72b1a93430b24b88eb3a72c6114d9f149737.zip |
Adding upstream version 2:9.1.0016.upstream/2%9.1.0016
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/plugin/gzip.vim')
-rw-r--r-- | runtime/plugin/gzip.vim | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/runtime/plugin/gzip.vim b/runtime/plugin/gzip.vim new file mode 100644 index 0000000..c02bd99 --- /dev/null +++ b/runtime/plugin/gzip.vim @@ -0,0 +1,61 @@ +" Vim plugin for editing compressed files. +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> + +" Exit quickly when: +" - this plugin was already loaded +" - when 'compatible' is set +" - some autocommands are already taking care of compressed files +if exists("loaded_gzip") || &cp || exists("#BufReadPre#*.gz") + finish +endif +let loaded_gzip = 1 + +augroup gzip + " Remove all gzip autocommands + au! + + " Enable editing of gzipped files. + " The functions are defined in autoload/gzip.vim. + " + " Set binary mode before reading the file. + " Use "gzip -d", gunzip isn't always available. + autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma,*.xz,*.lz,*.zst,*.br,*.lzo setlocal bin + autocmd BufReadPost,FileReadPost *.gz call gzip#read("gzip -dn") + autocmd BufReadPost,FileReadPost *.bz2 call gzip#read("bzip2 -d") + autocmd BufReadPost,FileReadPost *.Z call gzip#read("uncompress") + autocmd BufReadPost,FileReadPost *.lzma call gzip#read("lzma -d") + autocmd BufReadPost,FileReadPost *.xz call gzip#read("xz -d") + autocmd BufReadPost,FileReadPost *.lz call gzip#read("lzip -d") + autocmd BufReadPost,FileReadPost *.zst call gzip#read("zstd -d --rm") + autocmd BufReadPost,FileReadPost *.br call gzip#read("brotli -d --rm") + autocmd BufReadPost,FileReadPost *.lzo call gzip#read("lzop -d -U") + autocmd BufWritePost,FileWritePost *.gz call gzip#write("gzip") + autocmd BufWritePost,FileWritePost *.bz2 call gzip#write("bzip2") + autocmd BufWritePost,FileWritePost *.Z call gzip#write("compress -f") + autocmd BufWritePost,FileWritePost *.lzma call gzip#write("lzma -z") + autocmd BufWritePost,FileWritePost *.xz call gzip#write("xz -z") + autocmd BufWritePost,FileWritePost *.lz call gzip#write("lzip") + autocmd BufWritePost,FileWritePost *.zst call gzip#write("zstd --rm") + autocmd BufWritePost,FileWritePost *.br call gzip#write("brotli --rm") + autocmd BufWritePost,FileWritePost *.lzo call gzip#write("lzop -U") + autocmd FileAppendPre *.gz call gzip#appre("gzip -dn") + autocmd FileAppendPre *.bz2 call gzip#appre("bzip2 -d") + autocmd FileAppendPre *.Z call gzip#appre("uncompress") + autocmd FileAppendPre *.lzma call gzip#appre("lzma -d") + autocmd FileAppendPre *.xz call gzip#appre("xz -d") + autocmd FileAppendPre *.lz call gzip#appre("lzip -d") + autocmd FileAppendPre *.zst call gzip#appre("zstd -d --rm") + autocmd FileAppendPre *.br call gzip#appre("brotli -d --rm") + autocmd FileAppendPre *.lzo call gzip#appre("lzop -d -U") + autocmd FileAppendPost *.gz call gzip#write("gzip") + autocmd FileAppendPost *.bz2 call gzip#write("bzip2") + autocmd FileAppendPost *.Z call gzip#write("compress -f") + autocmd FileAppendPost *.lzma call gzip#write("lzma -z") + autocmd FileAppendPost *.xz call gzip#write("xz -z") + autocmd FileAppendPost *.lz call gzip#write("lzip") + autocmd FileAppendPost *.zst call gzip#write("zstd --rm") + autocmd FileAppendPost *.br call gzip#write("brotli --rm") + autocmd FileAppendPost *.lzo call gzip#write("lzop -U") +augroup END |