diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-07-11 19:12:04 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-11 19:12:04 +0200 |
commit | cc7eb2aa7a7f2e6ae41f1e7cf60965c083d8a9e9 (patch) | |
tree | 5d54a35c88c61f041e7cdd16ba3ad9aa40a084ef /src/usercmd.c | |
parent | 5231224e11bf468f5366a7400414368908c40795 (diff) |
patch 8.2.3149: some plugins have a problem with the error checkv8.2.3149
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.
Diffstat (limited to 'src/usercmd.c')
-rw-r--r-- | src/usercmd.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/usercmd.c b/src/usercmd.c index 94ebb43af0..42b9014f38 100644 --- 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); |