aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/cmdexpand.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-28 16:09:39 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-10-29 08:20:00 +0800
commit6b8c3d146ec0308fd19a9142b23b5e342e2cdcf8 (patch)
tree3aa44f8e29de049e84c9db98acb11fe195e5deba /src/nvim/cmdexpand.c
parent378d9135e7ac0f91a4944be816dc9f693d5078af (diff)
downloadrneovim-6b8c3d146ec0308fd19a9142b23b5e342e2cdcf8.tar.gz
rneovim-6b8c3d146ec0308fd19a9142b23b5e342e2cdcf8.tar.bz2
rneovim-6b8c3d146ec0308fd19a9142b23b5e342e2cdcf8.zip
vim-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: vim/vim#15929 https://github.com/vim/vim/commit/2f6efaccfd5c4e7df1f54ed0f41f329abbe05f60 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/cmdexpand.c')
-rw-r--r--src/nvim/cmdexpand.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 549ed826bc..5b7017481e 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -2497,21 +2497,25 @@ static int expand_files_and_dirs(expand_T *xp, char *pat, char ***matches, int *
}
}
- 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;
+ int ret = FAIL;
+ if (xp->xp_context == EXPAND_FILES_IN_PATH && *get_findexpr() != NUL) {
+ ret = expand_findexpr(pat, matches, numMatches);
} 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.
- int ret = expand_wildcards_eval(&pat, numMatches, matches, flags);
if (free_pat) {
xfree(pat);
}