I'd like to change another program other than zip/unzip to open a zip file such as 7z.
According to the doc, I changed the global variable g:zip_unzipcmd in my .vimrc:
let g:zip_unzipcmd = "7z"
It didn't work. This is because this plugin is primarily only for these two zip and unzip binary executable files, with some CLI options hard encoded. For example, this below codes in runtime/autoload/zip.vim:
let gnu_cmd = "keepj sil r! " . g:zip_unzipcmd . " -Z1 -- " . s:Escape(a:zipfile, 1)
In this pr, these hard coded options are eliminated, so that users can choose their program to open .zip files.
https://github.com/vim/vim/pull/20832
(2 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
this also requires an update to runtime/doc/pi_zip.txt. Also please be very careful, to not introduce command injection or arbitrary file writes. We had some security issues around this.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
Ok. This pr makes no difference to filename logic. I added more custom commands, and every default value of them should be checked by dist#vim#IsSafeExecutable prevent injection by environment, as before.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
The default commands use zip and unzip, and I tried using 7z:
let g:zip_browse= ["printf", "'';", \ "7zlbaf() { 7z l -ba \"$@\" | awk '{print ($3 ~ /D[^[:space:]]{4}/ ? $6 \"/\" : $6)}'; }", \ " && ", "7zlbaf"] " or save command as a file with `#!/bin/sh` let g:zip_read= ["7z", "x", "-so"] let g:zip_extract= ["7z", "x"] let g:zip_delete= ["7z", "d"] let g:zip_update= ["7z", "u"]
I found that 7z behaviors different on file names with special characters, such as a[a].txt or a*.txt. For example:
$ ls zipglob 'a[a].txt' 'a*.txt' 'a?.txt' 'a\.txt' 'a\\.txt' $ wc -l 'zipglob/a*.txt' 1 zipglob/a*.txt $ unzip -p exp.zip 'zipglob/a\*.txt' | wc -l 1 $ 7z x -so exp.zip 'zipglob/a\*.txt' | wc -l 2
This means the behavior of visiting(read/write) files that contains special character in a zip file without zip/unzip is unpredictable.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
This means the behavior of visiting(read/write) files that contains special character in a zip file without zip/unzip is unpredictable.
Not only that, the zip/unzip command line parser is already insane. There is no sane way to handle strange characters robustly.
That would mean we would need a custom escape function like what is done for powershell using PSEscape().
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
I found there's no support for Windows PowerShell 5, only PowerShell Core. So the CI test fails. I'll fix it.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
Not only that, the zip/unzip command line parser is already insane. There is no sane way to handle strange characters robustly.
That would mean we would need a custom escape function like what is done for powershell using
PSEscape().
When the commands to open/edit zip files are customizable, the resposibility to guarantee the correctness are transmit to the users. Based on this opinion, us developers should ensure the default behaviors are correct.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
As for my above example:
let g:zip_browse= ["printf", "'';", \ "7zlbaf() { 7z l -ba \"$@\" | awk '{print ($3 ~ /D[^[:space:]]{4}/ ? $6 \"/\" : $6)}'; }", \ " && ", "7zlbaf"]
This hack is not good since one more meanless command is executed. There's another example (on Windows):
let g:zip_browse = ["7zlbaf"] let g:zip_read = ["7z", "x", "-so"] let g:zip_extract = ["7z", "x"] let g:zip_delete = ["7z", "d"]
let g:zip_update = ["7z", "u"]
while the 7zlbaf.bat is a custom script file which is added to %PATH%(or $Env:Path), with awk installed:
@7z l -ba %* | awk.exe "{ gsub(/\\/, \""/\"", $6); print ($3 ~ /D[^[:space:]]{4}/ ? $6 \""/\"" : $6)}"
They are still not elegant. Maybe we should provide an API to let users to format the outputs of commands.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
so you think this is worthwhile? or shall we rather drop it?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()