Re: [vim/vim] runtime(zip)!: Customizable zip/unzip commands (PR #20832)

curbe454 (Vim Github Repository) <[email protected]> Wed, 29 Jul 2026 03:43:59 -0700
Newsgroups gmane.editors.vim.devel
Message-ID <vim/vim/pull/20832/[email protected]>
curbe454 left a comment (vim/vim#20832)

> ```batchfile
> @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, which may solve special character problem.

I tested providng a new API on my device (which is not committed):
```vim
if !exists("g:zip_browse_format")
  let g:zip_browse_tailcmd= [""]
endif

" ...

  let gnu_cmd = 'keepj sil r! ' . join(g:zip_browse) . ' ' . s:Escape(a:zipfile, 1) . ' ' . join(g:zip_browse_tailcmd)
```

And the configuration becomes to(on Windows):

```vim
let g:zip_browse  = ["7z l -ba"]
let g:zip_browse_format  = ["|", "awk", "'" . '{ gsub(/\\/, \\\"/\\\", $6); print ($3 ~ /D[^[:space:]]{4}/ ? $6 \\\"/\\\" : $6) }' . "'"]
```

It's kind of painful to debug to right codes because of escape characters. Or provide a customizable function `g:zip_browse_format` to format outputs, but this means manipulting strings with vimscript; and cannot make use of stream mechanism of pipe, which is more efficient.

So do not provide this API is better. Users can do some hack on the new global variables (`g:zip_browse`,  ...). Examples see my comments above.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20832#issuecomment-5116668948
You are receiving this because you are subscribed to this thread.

Message ID: <vim/vim/pull/20832/[email protected]>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/20832/c5116668948%40github.com.