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.
Best Answer
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 showLast 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
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.