Is there a setting that will allow you to just close the window without bothering with the save changes dialog when you exit?
Do you have to attach it to an event that answers for you?
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 community
This is standard behavior, shared by all the document-oriented GUI apps on your Desktop. The feature is provided by the GUI toolkit used to build GVim so I don't think there is a GVim-specific way to really change that behavior except, maybe, digging through the code and compiling it the way you like.
However, Vim, as a modal editor, kind of encourages explicitness and precision with all its commands. In this case, the proper Ex command for forcibly closing the current GUI window would be
That said, you can try to map
:qa!<CR>, but I just tried it with
<D-w> in MacVim and it didn't work at all.
If I were you, I would go with
I would not generally recommend it, because the risk to lose data is way too high, but since you ask for it:
:au QuitPre * :bw!
This will basically abort the current buffer when using
:q and if this is the last window it will automatically quit. An even more radical solution would be to wipe all buffers, which would then quit Vim even when there are several windows/tabpages open. But I won't spell it out explicitly, because I think this is too risky in my opinion.
Let's look at this from a different angle: Vim asks to save if there are changes to a buffer. You can make sure there are none by automatically writing all changes to file.
Obvious side effect: whatever you type ends up in the file.