1
0
forked from aniani/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: #15901
closes: #15905

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2024-10-22 23:42:20 +02:00
committed by Christian Brabandt
parent 626b6ab486
commit aeb1c97db5
17 changed files with 420 additions and 27 deletions

View File

@@ -6313,6 +6313,11 @@ unset_global_local_option(char_u *name, void *from)
case PV_FP:
clear_string_option(&buf->b_p_fp);
break;
# ifdef FEAT_EVAL
case PV_FEXPR:
clear_string_option(&buf->b_p_fexpr);
break;
# endif
# ifdef FEAT_QUICKFIX
case PV_EFM:
clear_string_option(&buf->b_p_efm);
@@ -6391,6 +6396,9 @@ get_varp_scope(struct vimoption *p, int scope)
switch ((int)p->indir)
{
case PV_FP: return (char_u *)&(curbuf->b_p_fp);
#ifdef FEAT_EVAL
case PV_FEXPR: return (char_u *)&(curbuf->b_p_fexpr);
#endif
#ifdef FEAT_QUICKFIX
case PV_EFM: return (char_u *)&(curbuf->b_p_efm);
case PV_GP: return (char_u *)&(curbuf->b_p_gp);
@@ -6501,6 +6509,10 @@ get_varp(struct vimoption *p)
#endif
case PV_FP: return *curbuf->b_p_fp != NUL
? (char_u *)&(curbuf->b_p_fp) : p->var;
#ifdef FEAT_EVAL
case PV_FEXPR: return *curbuf->b_p_fexpr != NUL
? (char_u *)&curbuf->b_p_fexpr : p->var;
#endif
#ifdef FEAT_QUICKFIX
case PV_EFM: return *curbuf->b_p_efm != NUL
? (char_u *)&(curbuf->b_p_efm) : p->var;
@@ -6747,6 +6759,21 @@ get_equalprg(void)
return curbuf->b_p_ep;
}
/*
* Get the value of 'findexpr', either the buffer-local one or the global one.
*/
char_u *
get_findexpr(void)
{
#ifdef FEAT_EVAL
if (*curbuf->b_p_fexpr == NUL)
return p_fexpr;
return curbuf->b_p_fexpr;
#else
return (char_u *)"";
#endif
}
/*
* Copy options from one window to another.
* Used when splitting a window.
@@ -7275,6 +7302,10 @@ buf_copy_options(buf_T *buf, int flags)
buf->b_p_efm = empty_option;
#endif
buf->b_p_ep = empty_option;
#if defined(FEAT_EVAL)
buf->b_p_fexpr = vim_strsave(p_fexpr);
COPY_OPT_SCTX(buf, BV_FEXPR);
#endif
buf->b_p_kp = empty_option;
buf->b_p_path = empty_option;
buf->b_p_tags = empty_option;