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.
To solve this nuisance with netrw permanently, I added this to my
" 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.
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
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.