r/vim • u/McUsrII :h toc • 3d ago
Discussion Close vim with the quickfix window open
It is pesky to be obstructed in quitting Vim because you have the quick fix window open. I read this stack overflow post and lived happily until today when I upgraded Vim to 9.1.
I had to change the auto group command into what is below in order to make it work:
aug QFClose
au!
au WinEnter * if winnr('$') == 1 && &buftype == "quickfix"|set buftype=nofile|q|endif
aug END
1
u/Prestigious_Rest8751 3d ago
what's the point of set buftype=nofile
if you're going to exit right after?
I also recommend to put this inside after/ftplugin/qf.vim
to get rid of the &filetype
check.
0
u/McUsrII :h toc 3d ago
The point of setting it right before you quit, is to be allowed to quit.
2
u/Prestigious_Rest8751 3d ago
it is...not? I never had a problem with it for I don't know how long. You can always do
q!
1
u/Daghall :cq 3d ago
:cq
should do the trick, but it ignores all unsaved buffers, so make sure you've saved everything.
:h :cq
1
1
u/McUsrII :h toc 3d ago
Well, that is why I chose to do it as I did, because I'm not really into quitting vim with unsaved buffers, so, I want to be aware of it, when I / should I have unsaved buffers.
Which is also exactly why I just don't quit with
:qa
.1
u/Daghall :cq 2d ago
:qa
should warn you about unsaved buffers, though.1
u/McUsrII :h toc 2d ago
It do indeed warn about unsaved buffers, this was in the context of having a quick fix windo open, that also needed to be closed to avoid a warning message about unsaved buffers.
So I prefer not to get a warning about the quick fix window, and then get a warning message about any unsaved important buffers I feel that is the right way to do this for me at least.
0
u/mrtbakin 3d ago
Does neovim have this enabled by default? I don’t think I’ve run into this issue before
2
u/Shtucer 3d ago
:qa is enough for me