0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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)
This commit is contained in:
Bram Moolenaar
2017-01-14 14:28:30 +01:00
parent 9b73c4a215
commit 9be7c04e6c
7 changed files with 43 additions and 16 deletions

View File

@@ -1984,7 +1984,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
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 @@ op_colon(oparg_T *oap)
}
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']");
}