diff options
author | raichoo <raichoo@googlemail.com> | 2017-03-09 17:33:51 +0100 |
---|---|---|
committer | raichoo <raichoo@googlemail.com> | 2017-03-19 21:14:11 +0100 |
commit | 0f5c3f111ab130f5cbb5943082ea5e877c1c2f4c (patch) | |
tree | 6ef5b9a051b32a9e8577150f2ab05f993a0fe07d /src/nvim/normal.c | |
parent | 2ad25c04663da7d08da94db84dc6ded7df11ea87 (diff) | |
download | rneovim-0f5c3f111ab130f5cbb5943082ea5e877c1c2f4c.tar.gz rneovim-0f5c3f111ab130f5cbb5943082ea5e877c1c2f4c.tar.bz2 rneovim-0f5c3f111ab130f5cbb5943082ea5e877c1c2f4c.zip |
vim-patch:8.0.0179
Problem: 'formatprg' is a global option but the value may depend on the
type of buffer. (Sung Pae)
Solution: Make 'formatprg' global-local. (closes vim/vim#1380)
https://github.com/vim/vim/commit/9be7c04e6cd5b0facedcb56b09a5bcfc339efe03
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 5a89fed207..82fa9f5f97 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1901,12 +1901,13 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) break; case OP_FORMAT: - if (*curbuf->b_p_fex != NUL) - op_formatexpr(oap); /* use expression */ - else if (*p_fp != NUL) - op_colon(oap); /* use external command */ - else - op_format(oap, false); /* use internal function */ + if (*curbuf->b_p_fex != NUL) { + op_formatexpr(oap); // use expression + } else if (*p_fp != NUL || *curbuf->b_p_fp != NUL) { + op_colon(oap); // use external command + } else { + op_format(oap, false); // use internal function + } break; case OP_FORMAT2: @@ -2064,10 +2065,13 @@ static void op_colon(oparg_T *oap) stuffReadbuff(get_equalprg()); stuffReadbuff((char_u *)"\n"); } 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']"); } |