I am trying to open archive files in Vim (zip files, jar files), but they are unreadable when opened.

For example, I created a zip file with one file in it:

$ touch testfile.txt
$ zip test.zip testfile.txt
  adding: testfile.txt (stored 0%)

Then I tried to open it via vim test.zip, but it is mostly unreadable with strange characters:

^@^@^@^@^@▒M~JO^@^@^@^@^@^@^@^@^@^@^@^@^L^@^\^@testfile.txtUT   ^@^C^U▒▒]^U▒▒]ux^K^@^A^Dd}R^@^Dd^@^@^@PK^A^B^^^C

When I type :scriptnames, I can see zipPlugin.vim and zip.vim:

  1: /etc/vimrc
  2: /usr/share/vim/vim74/syntax/syntax.vim
  3: /usr/share/vim/vim74/syntax/synload.vim
  4: /usr/share/vim/vim74/syntax/syncolor.vim
  5: /usr/share/vim/vim74/filetype.vim
  6: /usr/share/vim/vim74/ftplugin.vim
  7: /usr/share/vim/vim74/plugin/getscriptPlugin.vim
  8: /usr/share/vim/vim74/plugin/gzip.vim
  9: /usr/share/vim/vim74/plugin/matchparen.vim
 10: /usr/share/vim/vim74/plugin/netrwPlugin.vim
 11: /usr/share/vim/vim74/plugin/rrhelper.vim
 12: /usr/share/vim/vim74/plugin/spellfile.vim
 13: /usr/share/vim/vim74/plugin/tarPlugin.vim
 14: /usr/share/vim/vim74/plugin/tohtml.vim
 15: /usr/share/vim/vim74/plugin/vimballPlugin.vim
 16: /usr/share/vim/vim74/plugin/zipPlugin.vim
 17: /usr/share/vim/vim74/autoload/zip.vim
 18: /usr/share/vim/vim74/syntax/tar.vim

And this is the output of :messages:

Messages maintainer: Bram Moolenaar <[email protected]>
"~/tes/test.zip" [noeol] 3L, 174C

Here is my vim version:

$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jul 18 2019 16:14:10)
Included patches: 1-207, 209-629
Modified by <[email protected]>
Compiled by <[email protected]>
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
-clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            -ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim74"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -g -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE   -L/usr/local/lib -Wl,--as-needed -o vim        -lm -lnsl  -lselinux  -ltinfo -lacl -lattr -lgpm   -Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE  -fstack-protector  -L/usr/lib64/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc

I haven't made any changes to the default settings, and I don't have a ~/.vimrc file.

unzip is also installed:

$ unzip
UnZip 6.00 of 20 April 2009, by Info-ZIP.

Why are archive files unreadable? What other settings can I check?

  • If you type the command :au BufReadCmd *.zip, do you see a reference to zip#Browse in the output?
    – filbranden
    Dec 10, 2019 at 15:39
  • Yes, :au BufReadCmd *.zip\n --- Auto-Commands ---\n zip BufReadCmd\n *.zip call zip#Browse(expand("<amatch>"))
    – badjr
    Dec 10, 2019 at 15:42
  • Is it possible you're using a "minimal" or "tiny" build of Vim that doesn't include all necessary features? Any chance you could paste the full vim --version with all the +s and -s? (Edit your question and include it as a code block...)
    – filbranden
    Dec 10, 2019 at 23:09
  • Hmmm, but it did load autoload/zip.vim... Can you check if there are errors in :messages?
    – filbranden
    Dec 10, 2019 at 23:10
  • I added the details to the question.
    – badjr
    Dec 11, 2019 at 0:44

1 Answer 1


This was caused by my umask setting in my ~/.bashrc. It was set to 133:

$ umask

I set it to 033 and it fixed the issue:

$ umask 033
$ umask
$ vim test.zip
" zip.vim version v27
" Browsing zipfile /home/badjr/tes/test.zip
" Select a file with cursor and press ENTER


Not sure how that particular umask was affecting this, but the difference in 0 and 1 in umask is that 0 has directory permission rwx as opposed to 1 having rw-.

  • LOL... Glad you found it! umask 033 doesn't make that much sense, since files under any directory you create won't be accessible for group/other, so the "read" permissions won't really help... You might as well set it to 077 to keep all files user-readable only in that case... Or set it to 022 and protect the top of your home directory instead...
    – filbranden
    Dec 11, 2019 at 3:54

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.