patch 8.2.3149: some plugins have a problem with the error check
Problem: Some plugins have a problem with the error check for using
:command with -complete but without -nargs.
Solution: In legacy script only give a warning message.
diff --git a/src/usercmd.c b/src/usercmd.c
index 94ebb43..42b9014 100644
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -1027,7 +1027,15 @@
&& STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0))
emsg(_("E841: Reserved name, cannot be used for user defined command"));
else if (compl > 0 && (argt & EX_EXTRA) == 0)
- emsg(_(e_complete_used_without_nargs));
+ {
+ // Some plugins rely on silently ignoring the mistake, only make this
+ // an error in Vim9 script.
+ if (in_vim9script())
+ emsg(_(e_complete_used_without_nargs));
+ else
+ give_warning_with_source(
+ (char_u *)_(e_complete_used_without_nargs), TRUE, TRUE);
+ }
else
uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
addr_type_arg, eap->forceit);