patch 8.0.0179: cannot have a local value for 'formatprg'
Problem: 'formatprg' is a global option but the value may depend on the
type of buffer. (Sung Pae)
Solution: Make 'formatprg' global-local. (closes #1380)
diff --git a/src/normal.c b/src/normal.c
index 5d0796f..3456b73 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1984,7 +1984,7 @@
op_formatexpr(oap); /* use expression */
else
#endif
- if (*p_fp != NUL)
+ if (*p_fp != NUL || *curbuf->b_p_fp != NUL)
op_colon(oap); /* use external command */
else
op_format(oap, FALSE); /* use internal function */
@@ -2197,10 +2197,12 @@
}
else if (oap->op_type == OP_FORMAT)
{
- if (*p_fp == NUL)
- stuffReadbuff((char_u *)"fmt");
- else
+ if (*curbuf->b_p_fp != NUL)
+ stuffReadbuff(curbuf->b_p_fp);
+ else if (*p_fp != NUL)
stuffReadbuff(p_fp);
+ else
+ stuffReadbuff((char_u *)"fmt");
stuffReadbuff((char_u *)"\n']");
}