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.
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityI 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 .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.
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!
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.
x:special
command within the netrw directory listing. – Paul Rougieux May 25 '20 at 10:26