I agree that it’s the most obvious choice, but it also doesn’t work when there are hidden buffers open. :qa! and :cq should always work so they are arguably more correct
I agree that it’s the most obvious choice, but it also doesn’t work when there are hidden buffers open. :qa! and :cq should always work so they are arguably more correct
It’s useful when vim is being run from a different program or script.
For example, if I run
p4 change
to create a new Perforce changelist it will open up my editor (which I have set to vim) so that I can enter the CL description and other fields. If I realize I don’t actually actually want to create the CL yet I can use :cq to quit with an error so thatp4
knows to abort.I also have a script I use for diffing a list of file pairs. It runs vim diff on the first pair of files then if I exit with :qa it will move on to the next pair of files. But if I exit with :cq it will just abort and skip all of the remaining file pairs.