Hello,
I've made a small fix to vim's zip plugin.
Before the patch, the plugin could only edit filenames with the zip extension.
When using an autoloadcmd to open jars, the files would be edited
correctly, but they would be saved at the wrong place, and would be
ignored when opening the archive they were saved to.
The plugin basically stripped the zip suffix in some places, and added
it back at some point, causing these problems. Now the plugin always
uses the full path.

I'm using this to edit firefox extensions directly inside their jar
files. I'm also attaching a patch that adds the required associations
(jar and xpi, I'm sure there are more).

Cheers,
--
Gabriel de Perthuis
--- /usr/share/vim/vim70/autoload/zip.vim	2006-10-20 11:48:47.000000000 +0200
+++ autoload/zip.vim	2006-10-23 21:04:06.000000000 +0200
@@ -131,7 +131,7 @@
 "  call Decho("fname<".fname.">")
 
   " get zipfile to the new-window
-  let zipfile= substitute(w:zipfile,'.zip$','','e')
+  let zipfile= w:zipfile
   let curfile= expand("%")
 "  call Decho("zipfile<".zipfile.">")
 "  call Decho("curfile<".curfile.">")
@@ -255,8 +255,8 @@
    let zipfile = substitute(system("cygpath ".zipfile),'\n','','e')
   endif
 
-"  call Decho("zip -u '".zipfile.".zip' '".fname."'")
-  call system("zip -u '".zipfile.".zip' '".fname."'")
+"  call Decho("zip -u '".zipfile."' '".fname."'")
+  call system("zip -u '".zipfile."' '".fname."'")
   if v:shell_error != 0
    echohl Error | echo "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname | echohl None
    call inputsave()|call input("Press <cr> to continue")|call inputrestore()
@@ -264,12 +264,12 @@
   elseif s:zipfile_{winnr()} =~ '^\a\+://'
    " support writing zipfiles across a network
    let netzipfile= s:zipfile_{winnr()}
-"   call Decho("handle writing <".zipfile.".zip> across network as <".netzipfile.">")
+"   call Decho("handle writing <".zipfile."> across network as <".netzipfile.">")
    1split|enew
    let binkeep= &binary
    let eikeep = &ei
    set binary ei=all
-   exe "e! ".zipfile.".zip"
+   exe "e! ".zipfile
    call netrw#NetWrite(netzipfile)
    let &ei     = eikeep
    let &binary = binkeep
--- /usr/share/vim/vim70/plugin/zipPlugin.vim	2006-10-20 11:48:47.000000000 +0200
+++ plugin/zipPlugin.vim	2006-10-23 21:59:30.000000000 +0200
@@ -35,6 +35,8 @@
  endif
 
  au BufReadCmd   *.zip		call zip#Browse(expand("<amatch>"))
+ au BufReadCmd   *.jar		call zip#Browse(expand("<amatch>"))
+ au BufReadCmd   *.xpi		call zip#Browse(expand("<amatch>"))
 augroup END
 
 " ------------------------------------------------------------------------

Reply via email to