summaryrefslogtreecommitdiff
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index bf0372178..790b30ef1 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -4287,6 +4287,13 @@ do_sub(eap)
if (eap->skip) /* not executing commands, only parsing */
return;
+ if (!do_count && !curbuf->b_p_ma)
+ {
+ /* Substitusion is not allowed in non-'modifiable' buffer */
+ EMSG(_(e_modifiable));
+ return;
+ }
+
if (search_regcomp(pat, RE_SUBST, which_pat, SEARCH_HIS, &regmatch) == FAIL)
{
if (do_error)