18

I cannot exit vim even when I type :q!. I get the error

E37: No write since last change (add ! to override)
E162: No write since last change for buffer...

I think the buffer is a NetrwTreeListing readonly.

  • I noticed this happens in particular after using the x:special command within the netrw directory listing. – Paul Rougieux May 25 at 10:26
  • This editor is the worst piece of crap by multiple orders of magnitude, that I have ever seen in my entire life. – Gábor DANI Jul 1 at 7:08
12

To solve this nuisance with netrw permanently, I added this to my .vimrc:

" Per default, netrw leaves unmodified buffers open. This autocommand
" deletes netrw's buffer once it's hidden (using ':q', for example)
autocmd FileType netrw setl bufhidden=delete

From Tim Pope.

| improve this answer | |
8

This usually happens, if there are two or more buffers which are modified and Vim then usually toggles between them and shows the error message. So when :q! would abort the current buffer, it wouldn't not abort the other modified buffer, so therefore Vim protects you from losing changes and gives this error message.

If you are absolutely sure, you want to abort all modifications to all loaded buffers, then simply use :qa!

| improve this answer | |
5

Try

:bdelete!

or

:bd!

for short. This stands for "buffer delete" and will close the buffer you have open. (Credit goes to Emil Asmussen)

After that, you should be able to do :q! as normal.

| improve this answer | |
  • 2
    Ok, but why is it not letting me quit? – Tyler Durden May 21 '16 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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