aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index dd9f8203c1..af92a9c846 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3831,6 +3831,12 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
sublen = vim_regsub_multi(&regmatch,
sub_firstlnum - regmatch.startpos[0].lnum,
sub, sub_firstline, false, p_magic, true);
+ // If getting the substitute string caused an error, don't do
+ // the replacement.
+ if (aborting()) {
+ goto skip;
+ }
+
// Don't keep flags set by a recursive call
subflags = subflags_save;
if (subflags.do_count) {