1
0
forked from aniani/vim

patch 8.1.0573: cannot redefine user command without ! in same script

Problem:    Cannot redefine user command without ! in same script
Solution:   Allow redefining user command without ! in same script, like with
            functions.
This commit is contained in:
Bram Moolenaar
2018-12-08 16:03:28 +01:00
parent 76ab4fd619
commit 55d4691308
4 changed files with 59 additions and 13 deletions

View File

@@ -5869,9 +5869,13 @@ uc_add_command(
if (cmp == 0)
{
if (!force)
// Command can be replaced with "command!" and when sourcing the
// same script again, but only once.
if (!force && (cmd->uc_script_ctx.sc_sid != current_sctx.sc_sid
|| cmd->uc_script_ctx.sc_seq == current_sctx.sc_seq))
{
EMSG(_("E174: Command already exists: add ! to replace it"));
EMSG2(_("E174: Command already exists: add ! to replace it: %s"),
name);
goto fail;
}