Vim has support for compressed file formats such as zip, tar, gzip, bzip2 and many others. The supported operations are pretty simple: list the files inside the compressed file, view or edit one of those files and save the edited file back to the compressed file.
$ vim foobar.zip
$ vim foobar.tar.bz2
This will display the list of files inside the compressed file in the Vim edit window. The listing is flat: subdirectories and files within them are all listed in the edit window with the absolute file paths.
Normal Vim navigation j
k
and search commands are available to navigate this file listing.
Press Enter
on any listed file to open it in a new buffer for viewing and editing. You can edit this file as you normally do in Vim and when you write :w
the changed file, it is written back to the compressed file.
The support for compressed files is not recursive: if compressed file 1.zip
has another compressed file 2.zip
inside it, you will not be able to open 2.zip
from inside 1.zip
in Vim. You can open it, but it will appear as a binary file.
Only classic compressed file formats are supported:
.zip
.tar
.gz
.bz2
.Z
.lzma
.xz
.lz
.zst
:help zip
, :help tar
and :help gzip
.Tried with: Vim 8.0 and Ubuntu 18.04