Browsing tar files with Vim

Houki isn’t sure why she’s in a tape archive

Here’s a neat trick I learned today, entirely by accident. Say you were to open a tar file with Vim:

$ vim firewall-team.tar

You can view its contents and even edit the files inline!

" tar.vim version v26
" Browsing tarfile [..]/firewall-team.tar
" Select a file with cursor and press ENTER

firewall-team/
firewall-team/shinonono.houki
firewall-team/mizuno.ami
firewall-team/ayanami.rei
firewall-team/stadtfeld.kallen
firewall-team/littner.yoko

By comparison, nvi on FreeBSD and NetBSD will return fireworks. For certain times of the year this may be desirable, but may not be legal in certain juristictions. It’s also likely not what you’re after when browsing tar files.

firewall-team/^@^@^@^@^@^@^@^@^@^@^@^@^@^@
[..]

Emacs can also be used to read tar files, if your pinkie isn’t prone to repetitive stress injuries.