vim-fireplace/plugin/fireplace/zip.vim

41 lines
1.2 KiB
VimL
Raw Normal View History

2014-07-04 20:06:43 +00:00
" Location: plugin/fireplace/zip.vim
2014-07-03 18:49:18 +00:00
if exists("g:loaded_zip") || &cp || v:version >= 704
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.
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.
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