diff options
Diffstat (limited to 'src/nvim/optionstr.c')
| -rw-r--r-- | src/nvim/optionstr.c | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index 61a51532a4..cd87db9aa9 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -17,6 +17,7 @@ #include "nvim/drawscreen.h" #include "nvim/eval.h" #include "nvim/eval/typval_defs.h" +#include "nvim/eval/userfunc.h" #include "nvim/eval/vars.h" #include "nvim/ex_getln.h" #include "nvim/fold.h" @@ -1341,10 +1342,6 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf newFoldLevel(); } } - } else if (varp == &curwin->w_p_fde) { // 'foldexpr' - if (foldmethodIsExpr(curwin)) { - foldUpdateAll(curwin); - } } else if (gvarp == &curwin->w_allbuf_opt.wo_fmr) { // 'foldmarker' p = vim_strchr(*varp, ','); if (p == NULL) { @@ -1484,6 +1481,55 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf } } } + } else if (varp == &p_dex + || varp == &curwin->w_p_fde + || varp == &curwin->w_p_fdt + || gvarp == &p_fex + || gvarp == &p_inex + || gvarp == &p_inde + || varp == &p_pex + || varp == &p_pexpr) { // '*expr' options + char **p_opt = NULL; + + // If the option value starts with <SID> or s:, then replace that with + // the script identifier. + + if (varp == &p_dex) { // 'diffexpr' + p_opt = &p_dex; + } + if (varp == &curwin->w_p_fde) { // 'foldexpr' + p_opt = &curwin->w_p_fde; + } + if (varp == &curwin->w_p_fdt) { // 'foldtext' + p_opt = &curwin->w_p_fdt; + } + if (gvarp == &p_fex) { // 'formatexpr' + p_opt = &curbuf->b_p_fex; + } + if (gvarp == &p_inex) { // 'includeexpr' + p_opt = &curbuf->b_p_inex; + } + if (gvarp == &p_inde) { // 'indentexpr' + p_opt = &curbuf->b_p_inde; + } + if (varp == &p_pex) { // 'patchexpr' + p_opt = &p_pex; + } + if (varp == &p_pexpr) { // 'printexpr' + p_opt = &p_pexpr; + } + + if (p_opt != NULL) { + char *name = get_scriptlocal_funcname(*p_opt); + if (name != NULL) { + free_string_option(*p_opt); + *p_opt = name; + } + } + + if (varp == &curwin->w_p_fde && foldmethodIsExpr(curwin)) { + foldUpdateAll(curwin); + } } else if (gvarp == &p_cfu) { // 'completefunc' if (set_completefunc_option() == FAIL) { errmsg = e_invarg; |
