Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

During a OS upgrade (Linux), Vim or some part of it has been updated as well.

Now it happens that sometimes when I save a file (the file is not saved) I get this error:

E21: Cannot make changes, 'modifiable' is off

I did :help E21 and the manual says:

        {not in Vi}     *E21*
When off the buffer contents cannot be changed.  The 'fileformat' and
'fileencoding' options also can't be changed.
Can be reset with the |-M| command line argument.

It's not clear to me what it means. I use and start the editor the usual way, nothing is changed. The workflow is the same, too. I open different windows with CTLR-W N, then load and edit files there and switch between windows, etc.

I'd like to know how to disable this behavior and about side effects.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You can use :verbose set modifiable? to find out if a plugin is setting the option. If the option has been modified by a plugin, it will show Last set from /path/to/plugin/file (in addition to showing the value).

Maybe you are using the Netrw plugin. It comes bundled with Vim and handles “editing” local directories (listing the contents, picking files to view/edit) and remote file/directory access. I know it twiddles twiddles modifiable (and some other options). There may be a bug in the version bundled with your updated Vim. You can check the version number of the active installation of Netrw with :echo g:loaded_netrwPlugin.

If the problem seems to be related to Netrw, you might try installing another released version, or maybe a development version.

share|improve this answer
    
Thanks for the info. That was indeed a bug in Netrw. groups.google.com/d/msg/vim_dev/8K6qsQrpD5Y/MPQi5CHS89cJ –  Paolo Jun 11 '12 at 10:08

This happens when you open a file that is read-only. Check the file permissions: it seems that your user doesn't have write permission on the file. Or maybe the filesystem is mounted read-only (check with df /path/to/file to see on what filesystem the file is, and use mount or cat /proc/mounts to see the mount options).

A different possibility would be a buggy decoding plugin, but then I'd expect other error messages.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.