Viewing Zip files


There are several plugins that comes standard with Vim. Netrw is one we’ve covered some of already: Editing remote files and file system exploration. There’s another plugin that comes standard with Vim: zip.vim. This adds the ability to navigate through a compressed file archive without decompressing it. You can even edit files inside the archive while in Vim. They are compressed back into the archive when written to disk.

To use, simply open the file in Vim: :e and Vim will display a list of the contents and directory structure. Watch the Gif below. In it, I open a file called and then open a Markdown file contained in that Zip. When I edit the file and write the buffer with :w, then the modified contents are persisted back to the Zip.

Opening Zip files in Vim

This Zip file navigation trick works on other compressed archive formats, such as Tar and Gzip archives, thanks to some other plugins that ship with Vim. In fact, since a number of well-known file formats like Microsoft Office documents are essentially Zip archives with another extension, you can use this trick on a whole host of other file types like .docx and .xlsx.

Check out the source code of the zipPlugin.vim file in Vim for the full list.

How useful was this tip?

Average rating 3.7 / 5. Vote count: 319

No votes so far! Be the first to rate this tip.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Written by

Andy Libby

36 Posts

Rider of bicycles. Writer of code. User of Vim.
View all posts