gvim.exe arc.zip
(arc.zip). gVim opens the archive and places the cursor on its only file, 1 1.txt
.Enter
. A blank window is shown.The contents of 1 1.txt
should be shown.
9.1.466
OS: Windows 10 Home
UnZip: 5.51
Terminal: GUI.
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
hm, works on linux. On Windows I cannot seem to make the zip Plugin working. I guess I am missing an unzip command(?) What does that require?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
For the plugin to work I placed unzip.exe
(unzip.exe.zip) to $VIM\vimfiles
and added this line to my _vimrc: let g:zip_unzipcmd=$VIM .. "\\vimfiles\\unzip.exe"
.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Tried with a Wine (9.0) bottle for XP and GVim 7.0,
GnuWin's Unzip-5.51-1
, zip.vim
(v9, adapted), got:
caution: filename not matched: 1
caution: filename not matched: 1.txt
after doing :edit arc.zip
and Enter
ing on the file line.
Wrapping fname
in double quotes in zip#Read()
does the
trick (unzip.exe -p "C:/users/path/to/arc" "1 1.txt"
) of
writing 111
to a buffer:
exe 'silent r! '.g:zip_unzipcmd.' -p "'.zipfile.'" "'.fname.'"'
So the s:Escape(fnameescape(fname),1)
part should be further
looked into for a newer script version:
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Interestingly, the command executed on Linux is:
Calling shell to execute: "unzip -p -- '/home/chrisbra/code/vim-upstream/runtime/arc.zip' '1\ 1.txt'"
As far as I can see, this is the correct command to extract a single file using the unzip command. Note, one has to escape the whitespace, because unzip will otherwise try to extract the file "1" and "1.txt", because it splits on whitespace (but it falls back on literal filename matching, if it doesn't find the file specified).
On windows, escapeing the whitespace actually causes the error and one shall not escape the space. I tried the mentioned unzip from above (version 5.51 and a unzip package from msys, which also installs a infozip unzip package, version 6.01). So it seems we need to work-around a bug in unzip here :(
In addition, there is a problem when the shellslash option is set (as I usually do). Then unzip won't find the file obviously.
So all together, I have the following patch now:
diff --git a/zip - Kopie.vim b/zip.vim index c85c9fa..49e1916 100644 --- a/zip - Kopie.vim +++ b/zip.vim @@ -4,6 +4,8 @@ " Version: 33 " Maintainer: This runtime file is looking for a new maintainer. " Former Maintainer: Charles E Campbell +" Last Change: +" 2024 Jun 16 by Vim Project: handle whitespace on Windows properly (#14998) " License: Vim License (see vim's :help license) " Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, @@ -245,7 +247,7 @@ fun! zip#Read(fname,mode) let temp = tempname() " call Decho("using temp file<".temp.">") let fn = expand('%:p') - exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp + exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1).' > '.temp " call Decho("exe sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp) sil exe 'keepalt file '.temp sil keepj e! @@ -433,6 +435,10 @@ fun! s:Escape(fname,isfilt) else let qnameq= g:zip_shq.escape(a:fname,g:zip_shq).g:zip_shq endif + if exists("+shellslash") && &shellslash && &shell =~ "cmd.exe" + " renormalize directory separator + let qnameq=substitute(qnameq, '/', '\\', 'g') + endif " call Dret("QuoteFileDir <".qnameq.">") return qnameq endfun
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
These all work in Bash on a Debian box:
unzip -p arc.zip "1 1.txt" unzip -p arc.zip "1\ 1.txt" unzip -p arc.zip "1\\ 1.txt" unzip -p arc.zip '1 1.txt' unzip -p arc.zip '1\ 1.txt' unzip -p arc.zip 1\ 1.txt unzip -p arc.zip 1\\\ 1.txt
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Try that with an archive that contains "1.txt", "1" and "1 1.txt" :)
The handling of the 2nd parameter is weird at best
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Still, not a problem (and with globbing):
unzip -p arc3.zip '1*' unzip -p arc3.zip 1\* unzip -p arc3.zip 1 unzip -p arc3.zip 1.txt unzip -p arc3.zip 1\ 1.txt
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Closed #14998 as completed via 1c67342.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.