12

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.

9

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.

5

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!

4

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.

  • 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.