5

In an answer to this particular question, it's said that it's enough to have unzip installed and available to make vim able to unzip files on the fly. However, I'm wondering if there's a way to configure vim so that it doesn't use unzip, but rather any arbitrary archiver (which, of course, may need to meet certain requirements).

In particular, I'm interested in whether it's possible to use 7zip on a Windows machine.

1
  • 5
    Have a look at :h pi_zip.txt and check especially for the g:zip_unzipcmd variable Oct 29, 2020 at 7:21

2 Answers 2

1

zipPlugin shipped with Vim is poorly customizable. All command-line flags are hardcoded and cannot be changed. So there won't be any nice solution. Except maybe patching plugin's source code, or writing some wrapper shell script to re-translate option flags etc.

0

Maybe I'm misunderstanding your question, but you can call an arbitrary executable when opening a zip file. I don't use Windows, but if I wanted to unzip files automatically on Linux, dtrx -n looks like a good option:

" ~/.vim/after/ftplugin/zip.vim 
call system("dtrx -n " . shellescape(expand("%:p"))) | :e %:p:r

You will be shown the contents of the zip file as usual in the unzipped directory. This assumes that your tool can work non-interactively and uses a directory with the same as your zip file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.