I recently discovered that vim can open archives like .zip or tar.gz and list all files in them. We can even open the files in vim by pressing enter on a filename we want.

But I want to extract some of the files from an archive to another directory. Is there a way to do it with vim? I mean this:

enter image description here

//files list goes below
  • 2
    I think Vim is not suited for this task. If you want to extract text from a file from a tar/zip file, you can open it and yank the text. But if you want to extract a file from an archive, tar or unzip are the tools to look for. – nobe4 Oct 20 '16 at 8:10
  • 1
    Well, open it and save it wherever you want? – Christian Brabandt Oct 20 '16 at 9:57

For a single / few (text) files you can open them in Vim, and just use :write path/to/other/location to copy them elsewhere.

For non-text files, of if there are many of them, you'd better use the native archive commands (like tar or unzip) directly. The corresponding Vim plugins that enable the transparent archive access (:help pi_tar and :help pi_zip) use those commands internally, too, so you definitely have them on your system.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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