// troubleshooting guide · vim

Vim E21: Cannot Make Changes, 'modifiable' Is Off

Status
Workaround available
platforms:
Linux, macOS, Windows
updated:
November 23, 2026
reports:
4
Method
how we research
Share

RUNBOOK · vim/modifiable-is-off-e213 FIXES

// quick answer

The buffer is locked: either Vim was started with -M or a plugin window (NERDTree, help, netrw) set nomodifiable. For a normal file run :set modifiable; in plugin windows use the plugin's own commands instead.

Most likely fix: Make a normal file editable

How to fix it

// try these in order, the most common fix is first

  1. FIX 1Make a normal file editable

    1. 01Run :set modifiable (short :set ma)
    2. 02If it was opened read-only too, run :set noreadonly
    3. 03Or reopen the file without -M
    Did this fix it?
  2. FIX 2Use the plugin's commands in plugin windows

    1. 01In NERDTree press m to open the menu and a to add a file instead of typing in the tree
    2. 02Switch to a file window with Ctrl+W w before editing
    3. 03Avoid :set ma in plugin buffers; saving then fails with E382 because buftype is set
    Did this fix it?
  3. FIX 3Find the script that locks the buffer

    1. 01Run :verbose set modifiable? to see which script last changed it
    2. 02Disable or fix that autocommand or plugin
    Did this fix it?

SANDBOX · vim RUNS IN YOUR BROWSER

Try it: write a commit message in Vim (and get back out)

A hands-on Vim-style sandbox, including the spots where users get stuck. See where problems like this one start. 1-2 minutes, nothing is saved.

Symptoms

Typing in Insert mode or pressing x, dd or p shows E21: Cannot make changes, 'modifiable' is off.

Why it happens

  • C-01Vim launched with the -M flag (or as a view-only alias)
  • C-02You are in a plugin or special buffer such as NERDTree, netrw, :help or a quickfix list
  • C-03An autocommand or ftplugin set nomodifiable

// this guide also covers

  • vim modifiable is off
  • e21 cannot make changes
  • vim cannot make changes
  • nerdtree modifiable is off

Still not working?

If Vim keeps failing, you're not alone. See every Vim problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us

Watch Vim Get an email when its price changes, it has an outage, or we publish a new fix. No spam.

Fixed it? Share this guide

Other Vim errors

All 17 Vim errors and fixes →