Skip to content

Instantly share code, notes, and snippets.

@terrelln
Created October 25, 2016 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terrelln/19091598263de54c039b5a79f87a1b77 to your computer and use it in GitHub Desktop.
Save terrelln/19091598263de54c039b5a79f87a1b77 to your computer and use it in GitHub Desktop.
runtime/doc/pi_gzip.txt | 1 +
runtime/doc/usr_23.txt | 3 +++
runtime/plugin/gzip.vim | 6 +++++-
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/runtime/doc/pi_gzip.txt b/runtime/doc/pi_gzip.txt
index 31cd81b..f76507e 100644
--- a/runtime/doc/pi_gzip.txt
+++ b/runtime/doc/pi_gzip.txt
@@ -27,6 +27,7 @@ with these extensions:
*.bz2 bzip2
*.lzma lzma
*.xz xz
+ *.zst zstd
That's actually the only thing you need to know. There are no options.
diff --git a/runtime/doc/usr_23.txt b/runtime/doc/usr_23.txt
index d9c113c..1994384 100644
--- a/runtime/doc/usr_23.txt
+++ b/runtime/doc/usr_23.txt
@@ -332,6 +332,9 @@ compressing it again when you write it.
.Z compress
.gz gzip
.bz2 bzip2
+ .lzma lzma
+ .xz xz
+ .zst zstd
Vim uses the mentioned programs to do the actual compression and
decompression. You might need to install the programs first.
diff --git a/runtime/plugin/gzip.vim b/runtime/plugin/gzip.vim
index edef149..cf45d42 100644
--- a/runtime/plugin/gzip.vim
+++ b/runtime/plugin/gzip.vim
@@ -20,25 +20,29 @@ augroup gzip
"
" Set binary mode before reading the file.
" Use "gzip -d", gunzip isn't always available.
- autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma,*.xz setlocal bin
+ autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma,*.xz,*.zst 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 *.zst call gzip#read("zstd -q -d --rm")
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 *.zst call gzip#write("zstd -q --rm")
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 *.zst call gzip#appre("zstd -q -d --rm")
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 *.zst call gzip#write("zstd -q --rm")
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment