In vimscript, function definitions can take an abort argument. To quote the docs,
When the [abort] argument is added, the function will
abort as soon as an error is detected
This leads me to seriously question what exactly functions normally do when they encounter errors. Stumble blindly forth into the darkness?
What does abort actually do? Does it break all of the try...endtry blocks? When do you want to use it, and when do you want to avoid it?
As glts mentioned, all the complex details are documented at
:help except-compat, and the answer basically boils down to backwards compatibility and the inherent flexibility of Vimscript.There’s a natural progression from recorded macros to mappings to custom functions. With that in mind, it may make sense that when a command in a function causes an error (e.g. a
%s/foo/bar/that is not matching and missing theeflag), processing should continue.On the other hand, when you write “industrial-grade” mappings, you’ll almost always use a
try..catchblock inside your function call hierarchy, anyway (to avoid any multiline-errorsError detected while processing function: ..., and instead show a nice error message to the user).So in practice, most published plugins do not use
abort, buttry..catch, and for quick, off-the-cuff stuff, you typically don’t care too much about error handling, anyway.