/errors/vim/e37-no-write-since-last-change
Vim: E37: No write since last change (add ! to override)
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · VIM - Vi IMproved 9.2 (2026 Feb 14updated 2026-10-20
- tool
- Vim / Neovim
- exit code
- 1
- versions
- Vim 8, Vim 9, Neovim
- os
- any
Vim refuses to abandon a buffer with unsaved changes. Commands that would leave it, such as :q, :e other.txt or :bnext, stop with E37: No write since last change (add ! to override). Nothing is lost: decide whether to save the changes or throw them away.
Reproduce it
Vim in batch mode (-es), without any configuration (-Nu NONE): add text, then try to open another file.
printf 'one\n' > a.txt
vim -Nu NONE -i NONE -es \
-c 'normal! Atwo' \
-c 'silent! edit b.txt' \
-c 'call writefile([v:errmsg], "error.txt")' \
-c 'qa!' a.txt
cat error.txt
cat a.txt # unchanged on disk: qa! discarded the editOutput
E37: No write since last change (add ! to override) one
What to type
| Goal | Command |
|---|---|
| save and quit | :wq or :x, or ZZ in normal mode |
| quit without saving | :q! or ZQ |
| save everything and quit | :wqa |
| quit everything, discard all changes | :qa! |
| open another file, discard current changes | :e! other.txt |
| reload this file from disk | :e! |
| see which buffers are modified | :ls (marked with +) |
Switch files without saving first
set hiddenWith hidden (on by default in Neovim), :e, :bnext and friends keep the modified buffer open in the background instead of complaining. Vim still warns with E37 or E162 when you try to quit with modified buffers.
Sources
Related pages
commands · vimVim search and replace: :%s/old/new/g and its flagsReplace text in Vim with :%s/old/new/g; add c to confirm each change and i to ignore case, limit it to a range or a selection, and match whole words only.compare · vimVim vs Neovim: what differs and which to chooseNeovim is a Vim fork with Lua configuration, a built-in LSP client, Tree-sitter and modern defaults; Vim keeps Vim9 script and maximum compatibility. Compared.cheat sheets · regexRegex cheat sheet: characters, quantifiers, groups and lookaroundsRegex cheat sheet: character classes, anchors, quantifiers, greedy and lazy matching, groups and backreferences, lookarounds, with tested Python examples.