diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-10-30 22:22:23 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-08-14 18:20:27 -0400 |
commit | 903cd73af1985bbf51255958c15e353913588cd3 (patch) | |
tree | abf4ac853dfd3dfb53c61b0707914103d3d7d5e0 /src/nvim/ex_docmd.c | |
parent | 3ccdbc570d856ee3ff1f64204e352a40b9030ac2 (diff) | |
download | rneovim-903cd73af1985bbf51255958c15e353913588cd3.tar.gz rneovim-903cd73af1985bbf51255958c15e353913588cd3.tar.bz2 rneovim-903cd73af1985bbf51255958c15e353913588cd3.zip |
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.
https://github.com/vim/vim/commit/55d46913084745a48749d7ac4f48930852e1d87e
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 5bf6aa73c6..608b7dc94c 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -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; } |