How to fix common Vim error messages
For E37, type :wq to save and quit or :q! to throw the changes away. For E32, save with a name: :w notes.txt. For E45, :w!. E492 is a mistyped command, often :W. After a crash, E325 wants r to recover.

You pressed Enter on a command and Vim answered on the bottom line, in red: E37: No write since last change (add ! to override). Every Vim error looks like that, an E, a number and one short line, and the number is the quickest thing to search for. Your file is fine. Vim turned down one command and is waiting for the next.
Once the red line is gone, type :messages and press ↵ to see the last ones again and copy the exact text. Find your number below. If you're still in Insert mode (-- INSERT -- at the bottom), press Esc before typing any of the fixes.
E37: No write since last change
The file has changes you haven't saved, and the command you typed (:q, usually) would lose them. :wq saves and quits. :q! quits and throws the changes away, and the ! is the "override" the message asks for. How to exit Vim has every other way out.
Neovim 0.11 words it differently. A :q there prints E37: No write since last change without the part in brackets, and a second line under it, E162: No write since last change for buffer "notes.txt". The fix is the same.
Get past E37
Press the keys as you would in Vim. Nothing here closes anything.
E32: No file name
The text has never had a name. You started Vim on its own, with no file after vim, and now :w or :wq doesn't know where to write. Give the name once, :w notes.txt or :wq notes.txt, and every :w after that saves there. Vim and Neovim say exactly the same thing.
E45: 'readonly' option is set
E45: 'readonly' option is set (add ! to override) means Vim opened the file read-only. That happens when you open it with view or vim -R, and also when the file's own permissions don't let you write it. If the file is yours, :w! saves it anyway and leaves its permissions as they were. If it belongs to someone else, root for one, :w! fails with E212 instead.
E212: Can't open file for writing
The system won't let Vim write the file where it is. Vim prints the file's name in front of the message. Neovim adds the reason after it, permission denied or no such file or directory.
A missing folder is the easy one. You opened notes/2026/todo.txt, notes/2026 doesn't exist yet, and :w can't create it. Type :!mkdir -p %:h and press ↵ to make it, then :w again. %:h stands for the folder part of the file's name.
A file you aren't allowed to change, like /etc/hosts, needs administrator rights. In Vim, :w !sudo tee % > /dev/null saves it through sudo. How to save a file in Vim explains that line and what to do in Neovim, where it doesn't work.
Save past the error
Nothing here touches a real file.
E492: Not an editor command
Vim has no command by the name you typed, and it repeats what it read after the colon, so the typo is right there in the message. Most often Shift was still down. :W, :Wq and :Q all give E492, so type them again in lower case. Swapped letters do it too (:qw for :wq).
A shell command needs a ! in front. :git status is E492, and :!git status runs it. A plugin's command, such as :NERDTreeToggle, gives E492 when the plugin isn't installed or hasn't loaded.
Shift still down
You meant to save and quit, but your finger was still on Shift. In Normal mode you type :Wq and press ↵. What happens?
E486: Pattern not found
Your search went through the whole file without a match. The usual reason is capitals. A search matches case exactly unless you say otherwise, so /todo doesn't find TODO. Put \c anywhere in the pattern to ignore case for that one search: /\ctodo.
Cross it off
You've asked the baker about sourdough, so the note can go.
/\ctodo and ↵, then delete the line with ddmarket.txtThis editor needs a keyboard. Read on, and play it at your computer.
To stop worrying about case for good, type :set ignorecase smartcase. Searches then ignore case until you type a capital, and /Todo goes back to matching exactly.
:s and :%s give the same E486 when nothing matches. When no match is fine, in a command you run on lots of files for instance, add the e flag and Vim stays quiet: :%s/colour/color/ge.
E325: ATTENTION Found a swap file
While you edit, Vim keeps your unsaved changes in a swap file. Vim puts it next to the file, as .notes.txt.swp, and Neovim keeps its swap files in ~/.local/state/nvim/swap/. E325 means Vim found one when it opened the file. Either another Vim has the file open right now, or a Vim that was editing it crashed or was killed before it could tidy up.
The process ID line tells you which. (STILL RUNNING) after the number means the other copy is open, perhaps in another terminal tab, or paused with Ctrl-Z (type fg in that shell to bring it back). Without it, that session died, and the swap file may hold changes that never reached the file. The last line lists your choices, and you answer with one letter:
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
- o opens the file read-only, so you can look without changing anything. It's the one ↵ picks.
- e opens it as usual and ignores the swap file.
- r opens it with the changes from the swap file put back.
- d deletes the swap file and opens the file as usual. It's only offered when the process that made the swap file has gone.
- q doesn't open the file. If you'd only just started Vim, Vim exits.
- a does what q does, and also cancels any commands that were waiting to run after it.
After r, read the file through and :w if it's right. The old swap file stays behind, so the next time you open the file E325 asks again. Press d then, because what it held is in the file now.
Neovim 0.11 skips the question when the swap file belongs to another Neovim of yours that's still running. It opens the file as if you'd pressed e and says W325: Ignoring swapfile from Nvim process 12345.
Answer the swap file prompt
One letter each, in lower case. Vim takes either.
E21: Cannot make changes, 'modifiable' is off
This window isn't for editing. A help page is the usual one: :help opens one, and any key that would change its text gives E21. Close it with :q and you're back in your file. If you're sure the text is yours to change, :set modifiable turns editing back on.
| Message | What it means | What to type |
|---|---|---|
E37: No write since last change | The file has unsaved changes. | :wq to save and quit, :q! to drop the changes |
E162: No write since last change for buffer "notes.txt" | That file, open in Vim, has unsaved changes. | :wqa to save every file and quit, :qa! to drop them all |
E32: No file name | The text has never been saved. | :w notes.txt |
E45: 'readonly' option is set | The file was opened read-only. | :w!, if the file is yours |
E212: Can't open file for writing | The system won't let Vim write there. | :!mkdir -p %:h for a missing folder, sudo for a protected file |
E492: Not an editor command | No command has that name. | The command again, in lower case. :! before a shell command |
E486: Pattern not found | The search matched nothing. | /\ctodo to ignore case |
E325: ATTENTION | A swap file exists. Another Vim has the file open, or one crashed. | r to recover after a crash, q to back out |
E21: Cannot make changes, 'modifiable' is off | The window isn't for editing. | :q to close it |