1
0
forked from aniani/vim

patch 9.1.0568: Cannot expand paths from 'cdpath' setting

Problem:  Cannot expand paths from 'cdpath' setting
          (Daniel Hahler)
Solution: Implement 'cdpath' completion, add the new 'dir_in_path'
          completion type (LemonBoy)

fixes #374
closes: #15205

Signed-off-by: LemonBoy <thatlemon@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
LemonBoy
2024-07-11 22:35:53 +02:00
committed by Christian Brabandt
parent 764526e279
commit a20bf69a3b
14 changed files with 56 additions and 21 deletions

View File

@@ -4003,6 +4003,8 @@ gen_expand_wildcards(
int add_pat;
int retval = OK;
int did_expand_in_path = FALSE;
char_u *path_option = *curbuf->b_p_path == NUL ?
p_path : curbuf->b_p_path;
/*
* expand_env() is called to expand things like "~user". If this fails,
@@ -4092,7 +4094,7 @@ gen_expand_wildcards(
*/
if (mch_has_exp_wildcard(p) || (flags & EW_ICASE))
{
if ((flags & EW_PATH)
if ((flags & (EW_PATH | EW_CDPATH))
&& !mch_isFullName(p)
&& !(p[0] == '.'
&& (vim_ispathsep(p[1])
@@ -4126,8 +4128,8 @@ gen_expand_wildcards(
vim_free(t);
}
if (did_expand_in_path && ga.ga_len > 0 && (flags & EW_PATH))
uniquefy_paths(&ga, p);
if (did_expand_in_path && ga.ga_len > 0 && (flags & (EW_PATH | EW_CDPATH)))
uniquefy_paths(&ga, p, path_option);
if (p != pat[i])
vim_free(p);
}