aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-28 15:14:15 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-10-29 08:20:00 +0800
commit378d9135e7ac0f91a4944be816dc9f693d5078af (patch)
tree73d8ee9d95a9e1ae134e1eca0f8e741716290044 /src/nvim/option.c
parent42fa3d080ec170b7927e36ec563efdd526c712d7 (diff)
downloadrneovim-378d9135e7ac0f91a4944be816dc9f693d5078af.tar.gz
rneovim-378d9135e7ac0f91a4944be816dc9f693d5078af.tar.bz2
rneovim-378d9135e7ac0f91a4944be816dc9f693d5078af.zip
vim-patch:9.1.0810: cannot easily adjust the |:find| command
Problem: cannot easily adjust the |:find| command Solution: Add support for the 'findexpr' option (Yegappan Lakshmanan) closes: vim/vim#15901 closes: vim/vim#15905 https://github.com/vim/vim/commit/aeb1c97db5b9de4f4903e7f288f2aa5ad6c49440 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
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;