1

I tried to edit a zip file and change its content using the following commands

:set modifiable
:%s/xxA/..\//g
:x!

But it returned the following error

W10: Warning: Changing a readonly file
55 substitutions on 10 lines
Press ENTER or type command to continue

After I pressed Enter nothing changed. Please guide me to solve this problem.

statox
  • 49,782
  • 19
  • 148
  • 225
SuperKrish
  • 217
  • 1
  • 5

1 Answers1

3

Vim ships with the zip plugin (:help pi_zip) that lets you automatically browse and edit the contents of the zip file. These browse buffers are read-only. In order to read the actual zip file, you need to use binary mode: $ vim -b archive.zip.

If you did use binary mode, the readonly buffer originates from the zip file's file system permissions. Sometimes you can force a write with :w!, else you have to first give your user write access ($ chmod +w archive.zip).

Ingo Karkat
  • 17,819
  • 1
  • 45
  • 61