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:
PK^C^D
^@^@^@^@^@▒M~JO^@^@^@^@^@^@^@^@^@^@^@^@^L^@^\^@testfile.txtUT ^@^C^U▒▒]^U▒▒]ux^K^@^A^Dd}R^@^Dd^@^@^@PK^A^B^^^C
^@^@^@^@^@▒M~JO^@^@^@^@^@^@^@^@^@^@^@^@^L^@^X^@^@^@^@^@^@^@^@^@▒~A^@^@^@^@testfile.txtUT^E^@^C^U▒▒]ux^K^@^A^Dd}R^@^Dd^@^@^@PK^E^F^@^@^@^@^A^@^A^@R^@^@^@F^@^@^@^@^@
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 <Bram@vim.org>
"~/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 <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
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?
:au BufReadCmd *.zip
, do you see a reference tozip#Browse
in the output? – filbranden♦ Dec 10 '19 at 15:39vim --version
with all the+
s and-
s? (Edit your question and include it as a code block...) – filbranden♦ Dec 10 '19 at 23:09autoload/zip.vim
... Can you check if there are errors in:messages
? – filbranden♦ Dec 10 '19 at 23:10