char_u *p;
static int recursive = FALSE;
int add_pat;
+#if defined(FEAT_SEARCHPATH)
+ int did_expand_in_path = FALSE;
+#endif
/*
* expand_env() is called to expand things like "~user". If this fails,
if (mch_has_exp_wildcard(p))
{
#if defined(FEAT_SEARCHPATH)
- if (*p != '.' && !vim_ispathsep(*p) && (flags & EW_PATH))
+ if ((flags & EW_PATH)
+ && !mch_isFullName(p)
+ && !(p[0] == '.'
+ && (vim_ispathsep(p[1])
+ || (p[1] == '.' && vim_ispathsep(p[2]))))
+ )
{
- /* recursiveness is OK here */
+ /* :find completion where 'path' is used.
+ * Recursiveness is OK here. */
recursive = FALSE;
add_pat = expand_in_path(&ga, p, flags);
recursive = TRUE;
+ did_expand_in_path = TRUE;
}
else
#endif
}
#if defined(FEAT_SEARCHPATH)
- if (ga.ga_len > 0 && (flags & EW_PATH))
+ if (did_expand_in_path && ga.ga_len > 0 && (flags & EW_PATH))
uniquefy_paths(&ga, p);
#endif
if (p != pat[i])
:exec "cd " . cwd . "/Xfind/in"
:find file
:exec "w >>" . test_out
+:" Test for relative to current buffer 'path' item
+:exec "cd " . cwd . "/Xfind/"
+:set path=./path
+:" Open the file where Jimmy Hoffa is found
+:e in/file.txt
+:" Find the file containing 'E.T.' in the Xfind/in/path directory
+:find file
+:exec "w >>" . test_out
:q
:exec "cd " . cwd
:call DeleteDirectory("Xfind")