vim/vim-7.2-lzma-support.patch

103 lines
4.6 KiB
Diff

--- runtime/plugin/gzip.vim
+++ runtime/plugin/gzip.vim 2007-07-10 14:32:54.000000000 +0200
@@ -20,17 +20,21 @@ augroup gzip
"
" Set binary mode before reading the file.
" Use "gzip -d", gunzip isn't always available.
- autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z setlocal bin
+ autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma 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 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")
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 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")
augroup END
--- runtime/autoload/tar.vim
+++ runtime/autoload/tar.vim 2008-08-27 14:53:48.000000000 +0200
@@ -371,6 +371,14 @@ fun! tar#Write(fname)
let tarfile = substitute(tarfile,'\.bz2','','e')
let compress= "bzip2 -- ".s:Escape(tarfile,0)
" call Decho("compress<".compress.">")
+ elseif tarfile =~# '\.lzma'
+ call system("lzma -d ".tarfile)
+ let tarfile = substitute(tarfile,'\.lzma','','e')
+ let compress= "lzma '".tarfile."'"
+ elseif tarfile =~# '\.tlz'
+ call system("lzma -d ".tarfile)
+ let tarfile = substitute(tarfile,'\.tlz','tar','e')
+ let compress= "lzma '".tarfile."'"
endif
" call Decho("tarfile<".tarfile.">")
--- runtime/autoload/getscript.vim
+++ runtime/autoload/getscript.vim 2008-08-27 14:54:40.000000000 +0200
@@ -542,6 +542,11 @@ fun! s:GetOneScript(...)
exe "silent !gunzip ".s:Escape(sname)
let sname= substitute(sname,'\.gz$','','')
" call Decho("decompress: new sname<".sname."> after gunzip")
+ elseif sname =~ '\.lzma$'
+" call Decho("decompress: attempt to gunzip ".sname)
+ exe "silent !unlzma ".sname
+ let sname= substitute(sname,'\.lzma$','','')
+" call Decho("decompress: new sname<".sname."> after unlzma")
endif
" distribute archive(.zip, .tar, .vba) contents
--- runtime/filetype.vim
+++ runtime/filetype.vim 2007-07-11 11:35:26.000000000 +0200
@@ -34,7 +34,7 @@ au BufNewFile,BufRead ?\+.in
" Pattern used to match file names which should not be inspected.
" Currently finds compressed files.
if !exists("g:ft_ignore_pat")
- let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'
+ let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\|lzma\|tlz\)$'
endif
" Function used for patterns that end in a star: don't set the filetype if the
--- runtime/autoload/netrw.vim
+++ runtime/autoload/netrw.vim 2008-08-27 14:49:59.000000000 +0200
@@ -1362,6 +1362,9 @@ fun! s:NetrwGetFile(readcmd, tfile, meth
elseif rfile =~ '\.tar\.bz2'
" call Decho("handling remote bz2-compressed tar file")
call tar#Browse(tfile)
+ elseif rfile =~ '\.tar\.lzma'
+" call Decho("handling remote lzma-compressed tar file")
+ call tar#Browse(tfile)
else
" call Decho("edit temporary file")
e!
@@ -7237,7 +7240,7 @@ fun! s:GetTempfile(fname)
if a:fname != ""
if a:fname =~ '\.[^./]\+$'
" call Decho("using fname<".a:fname.">'s suffix")
- if a:fname =~ '.tar.gz' || a:fname =~ '.tar.bz2'
+ if a:fname =~ '.tar.gz' || a:fname =~ '.tar.bz2' || a:fname =~ '.tar.lzma'
let suffix = ".tar".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
else
let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
--- runtime/autoload/vimball.vim
+++ runtime/autoload/vimball.vim 2008-08-27 14:55:40.000000000 +0200
@@ -516,6 +516,11 @@ fun! vimball#Decompress(fname)
exe "e ".escape(fname,' \')
call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
+ elseif expand("%") =~ '.*\.lzma' && executable("unlzma")
+ exe "!unlzma ".a:fname
+ let fname= substitute(a:fname,'\.lzma$','','')
+ exe "e ".escape(fname,' \')
+ call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)")
elseif expand("%") =~ '.*\.zip' && executable("unzip")
" handle *.zip with unzip
silent exe "!unzip ".s:Escape(a:fname)