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.

2

1 Answer 1

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).

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.