diff src/usercmd.c @ 25226:a9ea83a3659a v8.2.3149

patch 8.2.3149: some plugins have a problem with the error check Commit: https://github.com/vim/vim/commit/cc7eb2aa7a7f2e6ae41f1e7cf60965c083d8a9e9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 11 19:12:04 2021 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 11 Jul 2021 19:15:03 +0200
parents 8d816c266ceb
children b80e4e9c4988
line wrap: on
line diff
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -1027,7 +1027,15 @@ ex_command(exarg_T *eap)
 		  && 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);