I am looking for an example of using the findfile function in a vim script to search recursively for a file, especially using a wildcard.
Whenever I include a wildcard as part of the first parameter of a function, this does not work.
For example, with the following directory structure:
~/MyProject/ Test.sln src/ Test.cs
If I run the following function by editing the Test.cs file with pwd set to ~ / MyProject / src
function! Test() let a = findfile("*.sln", ".;") echo a endfunction
findfile does not seem to return anything. However, if I change the function to remove the widcard as follows:
function! Test() let a = findfile("Test.sln", ".;") echo a endfunction
He does what I expect.
I tested this on both ubuntu and windows, and I see the same behavior on both. Am I doing something wrong here, or does findfile just not support wildcards? The lack of wildcard support seems a rather strange omission. Looks like I should be doing something wrong.
source share