patch 9.1.0811: :find expansion does not consider 'findexpr'
Problem: :find expansion does not consider 'findexpr'
Solution: Support expanding :find command argument using 'findexpr'
(Yegappan Lakshmanan)
closes: #15929
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index 3f74f47..406135c 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -2819,7 +2819,7 @@
{
int free_pat = FALSE;
int i;
- int ret;
+ int ret = FAIL;
// for ":set path=" and ":set tags=" halve backslashes for escaped
// space
@@ -2850,19 +2850,28 @@
}
}
- if (xp->xp_context == EXPAND_FILES)
- flags |= EW_FILE;
- else if (xp->xp_context == EXPAND_FILES_IN_PATH)
- flags |= (EW_FILE | EW_PATH);
- else if (xp->xp_context == EXPAND_DIRS_IN_CDPATH)
- flags = (flags | EW_DIR | EW_CDPATH) & ~EW_FILE;
+ if (xp->xp_context == EXPAND_FILES_IN_PATH && *get_findexpr() != NUL)
+ {
+#ifdef FEAT_EVAL
+ ret = expand_findexpr(pat, matches, numMatches);
+#endif
+ }
else
- flags = (flags | EW_DIR) & ~EW_FILE;
- if (options & WILD_ICASE)
- flags |= EW_ICASE;
+ {
+ if (xp->xp_context == EXPAND_FILES)
+ flags |= EW_FILE;
+ else if (xp->xp_context == EXPAND_FILES_IN_PATH)
+ flags |= (EW_FILE | EW_PATH);
+ else if (xp->xp_context == EXPAND_DIRS_IN_CDPATH)
+ flags = (flags | EW_DIR | EW_CDPATH) & ~EW_FILE;
+ else
+ flags = (flags | EW_DIR) & ~EW_FILE;
+ if (options & WILD_ICASE)
+ flags |= EW_ICASE;
- // Expand wildcards, supporting %:h and the like.
- ret = expand_wildcards_eval(&pat, numMatches, matches, flags);
+ // Expand wildcards, supporting %:h and the like.
+ ret = expand_wildcards_eval(&pat, numMatches, matches, flags);
+ }
if (free_pat)
vim_free(pat);
#ifdef BACKSLASH_IN_FILENAME