Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/vim71/plugin/gzip.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim71/plugin/gzip.vim')
-rw-r--r--vim71/plugin/gzip.vim36
1 files changed, 36 insertions, 0 deletions
diff --git a/vim71/plugin/gzip.vim b/vim71/plugin/gzip.vim
new file mode 100644
index 0000000..6560238
--- /dev/null
+++ b/vim71/plugin/gzip.vim
@@ -0,0 +1,36 @@
+" Vim plugin for editing compressed files.
+" Maintainer: Bram Moolenaar <Bram@vim.org>
+" Last Change: 2005 Jul 26
+
+" 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 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 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 FileAppendPre *.gz call gzip#appre("gzip -dn")
+ autocmd FileAppendPre *.bz2 call gzip#appre("bzip2 -d")
+ autocmd FileAppendPre *.Z call gzip#appre("uncompress")
+ autocmd FileAppendPost *.gz call gzip#write("gzip")
+ autocmd FileAppendPost *.bz2 call gzip#write("bzip2")
+ autocmd FileAppendPost *.Z call gzip#write("compress -f")
+augroup END