@yegappan thanks for the comparison to the other
do
commands, for the explanation of the test, and for demonstrating that that definition of:cdo
explains basically all the behavior.It is still unexpected behavior, and here is why:
:help :cdo < When the current file can't be |abandon|ed and the [!] is not present, the command fails. When an error is detected execution stops. The last buffer (or where an error occurred) becomes the current buffer.
I see where you might have a point re: abandoning buffers. But the help says: "When an error is detected execution stops." Does this mean an error in
:cdo
(like the aforementioned abandon failure)? Or does this mean an error in{cmd}
given to:cdo
? Most users (myself included) seem to believe it's the latter—are you clarifying it is the former? Either way, we must update the help to be unambiguous (and it may be more useful to use the latter as actual behavior, given that:cdo
operates at each entry, like:global
(which, in fact, stops at the first error)).