mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 03:08:27 +00:00
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.
55d4691308
This commit is contained in:
@@ -5026,8 +5026,13 @@ static int uc_add_command(char_u *name, size_t name_len, char_u *rep,
|
||||
}
|
||||
|
||||
if (cmp == 0) {
|
||||
if (!force) {
|
||||
EMSG(_("E174: Command already exists: add ! to replace it"));
|
||||
// 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)) {
|
||||
EMSG2(_("E174: Command already exists: add ! to replace it: %s"),
|
||||
name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user