aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 8fa4e23df6..6f7d5ed6e4 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -21504,7 +21504,11 @@ void ex_function(exarg_T *eap)
fp = find_func(name);
if (fp != NULL) {
- if (!eap->forceit) {
+ // Function can be replaced with "function!" and when sourcing the
+ // same script again, but only once.
+ if (!eap->forceit
+ && (fp->uf_script_ctx.sc_sid != current_sctx.sc_sid
+ || fp->uf_script_ctx.sc_seq == current_sctx.sc_seq)) {
emsg_funcname(e_funcexts, name);
goto erret;
}