2014-07-04 20:06:43 +00:00
|
|
|
" Location: plugin/fireplace/zip.vim
|
2013-01-08 03:32:57 +00:00
|
|
|
|
2014-07-03 18:49:18 +00:00
|
|
|
if exists("g:loaded_zip") || &cp || v:version >= 704
|
2013-01-08 03:32:57 +00:00
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
|
|
|
runtime! autoload/zip.vim
|
|
|
|
|
2014-07-04 19:04:36 +00:00
|
|
|
" Patched to allow loading from the quickfix list. The version that ships
|
|
|
|
" with Vim 7.4 already has this change.
|
2013-01-08 03:32:57 +00:00
|
|
|
|
|
|
|
fun! zip#Read(fname,mode)
|
|
|
|
" call Dfunc("zip#Read(fname<".a:fname.">,mode=".a:mode.")")
|
|
|
|
let repkeep= &report
|
|
|
|
set report=10
|
|
|
|
|
|
|
|
if has("unix")
|
|
|
|
let zipfile = substitute(a:fname,'zipfile:\(.\{-}\)::[^\\].*$','\1','')
|
|
|
|
let fname = substitute(a:fname,'zipfile:.\{-}::\([^\\].*\)$','\1','')
|
|
|
|
else
|
|
|
|
let zipfile = substitute(a:fname,'^.\{-}zipfile:\(.\{-}\)::[^\\].*$','\1','')
|
|
|
|
let fname = substitute(a:fname,'^.\{-}zipfile:.\{-}::\([^\\].*\)$','\1','')
|
|
|
|
let fname = substitute(fname, '[', '[[]', 'g')
|
|
|
|
endif
|
|
|
|
" call Decho("zipfile<".zipfile.">")
|
|
|
|
" call Decho("fname <".fname.">")
|
|
|
|
|
2013-03-12 19:37:37 +00:00
|
|
|
" Changes for fireplace.
|
2013-01-08 03:32:57 +00:00
|
|
|
let temp = tempname()
|
|
|
|
let fn = expand('%:p')
|
|
|
|
exe "sil! ! ".g:zip_unzipcmd." -p -- ".shellescape(zipfile,1)." ".shellescape(fnameescape(fname),1). ' > '.temp
|
|
|
|
silent exe 'keepalt file '.temp
|
|
|
|
silent keepjumps edit!
|
|
|
|
silent exe 'keepalt file '.fnameescape(fn)
|
|
|
|
call delete(temp)
|
|
|
|
filetype detect
|
|
|
|
|
|
|
|
" Resume regularly scheduled programming.
|
|
|
|
set nomod
|
|
|
|
endfun
|