aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-29 09:01:46 +0800
committerGitHub <noreply@github.com>2024-10-29 09:01:46 +0800
commit0e32c480604d76a319602656f2d8e2722497606e (patch)
treeb18deb6eaae322957f27ae87e134f7c8bb3ee5e9 /src/nvim/option.c
parent42fa3d080ec170b7927e36ec563efdd526c712d7 (diff)
parent60b3ccd850ca038af6fc0a19cad12578f63d67ec (diff)
downloadrneovim-0e32c480604d76a319602656f2d8e2722497606e.tar.gz
rneovim-0e32c480604d76a319602656f2d8e2722497606e.tar.bz2
rneovim-0e32c480604d76a319602656f2d8e2722497606e.zip
Merge pull request #30979 from zeertzjq/vim-9.1.0810
vim-patch:9.1.{0810,0811,0821}: 'findexpr'
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 7c32c99d0e..65f03ca77f 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -4530,6 +4530,8 @@ void *get_varp_scope_from(vimoption_T *p, int scope, buf_T *buf, win_T *win)
switch ((int)p->indir) {
case PV_FP:
return &(buf->b_p_fp);
+ case PV_FEXPR:
+ return &(buf->b_p_fexpr);
case PV_EFM:
return &(buf->b_p_efm);
case PV_GP:
@@ -4651,6 +4653,8 @@ void *get_varp_from(vimoption_T *p, buf_T *buf, win_T *win)
return *buf->b_p_tsrfu != NUL ? &(buf->b_p_tsrfu) : p->var;
case PV_FP:
return *buf->b_p_fp != NUL ? &(buf->b_p_fp) : p->var;
+ case PV_FEXPR:
+ return *buf->b_p_fexpr != NUL ? &(buf->b_p_fexpr) : p->var;
case PV_EFM:
return *buf->b_p_efm != NUL ? &(buf->b_p_efm) : p->var;
case PV_GP:
@@ -4922,6 +4926,15 @@ char *get_equalprg(void)
return curbuf->b_p_ep;
}
+/// Get the value of 'findexpr', either the buffer-local one or the global one.
+char *get_findexpr(void)
+{
+ if (*curbuf->b_p_fexpr == NUL) {
+ return p_fexpr;
+ }
+ return curbuf->b_p_fexpr;
+}
+
/// Copy options from one window to another.
/// Used when splitting a window.
void win_copy_options(win_T *wp_from, win_T *wp_to)
@@ -5320,6 +5333,8 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_mp = empty_string_option;
buf->b_p_efm = empty_string_option;
buf->b_p_ep = empty_string_option;
+ buf->b_p_fexpr = xstrdup(p_fexpr);
+ COPY_OPT_SCTX(buf, BV_FEXPR);
buf->b_p_kp = empty_string_option;
buf->b_p_path = empty_string_option;
buf->b_p_tags = empty_string_option;