comparison src/ex_docmd.c @ 15125:b101b193d5ff v8.1.0573

patch 8.1.0573: cannot redefine user command without ! in same script commit https://github.com/vim/vim/commit/55d46913084745a48749d7ac4f48930852e1d87e Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 8 16:03:28 2018 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 08 Dec 2018 16:15:05 +0100
parents 39728d503e47
children 1ef429366fd4
comparison
equal deleted inserted replaced
15124:27c801cca007 15125:b101b193d5ff
5867 cmp = 1; 5867 cmp = 1;
5868 } 5868 }
5869 5869
5870 if (cmp == 0) 5870 if (cmp == 0)
5871 { 5871 {
5872 if (!force) 5872 // Command can be replaced with "command!" and when sourcing the
5873 { 5873 // same script again, but only once.
5874 EMSG(_("E174: Command already exists: add ! to replace it")); 5874 if (!force && (cmd->uc_script_ctx.sc_sid != current_sctx.sc_sid
5875 || cmd->uc_script_ctx.sc_seq == current_sctx.sc_seq))
5876 {
5877 EMSG2(_("E174: Command already exists: add ! to replace it: %s"),
5878 name);
5875 goto fail; 5879 goto fail;
5876 } 5880 }
5877 5881
5878 VIM_CLEAR(cmd->uc_rep); 5882 VIM_CLEAR(cmd->uc_rep);
5879 #if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) 5883 #if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)