When Vim is invoked on multiple files from the command line, then if any of those files have not been visited with
:next or via buffer switching, the
:q command pointlessly warns about the situation with a message like "43 files left to edit" and refuses to quit, even though nothing has been modified. Is there a way to eliminate this behavior?
:help documentation, we have:
:q[uit] Quit the current window. Quit Vim if this is the last
window. This fails when changes have been made and
Vim refuses to abandon the current buffer, and when
the last file in the argument list has not been
If there are other tab pages and quitting the last
window in the current tab page the current tab page is
Triggers the QuitPre autocommand event.
See CTRL-W_q for quitting another window.
which just confirms the behavior: "fails ... when the last file in the argument list has not been edited".
The forced execution
:q! will work, but is not acceptable because it will discard unsaved changes.
The documentation does not seem to mention that if the command fails due to the last file not having been edited, simply repeating the command will then force it.