I read :h starstar-wildcard, but I cannot understand some cases.

(In the following examples, I am using the command :vimgrep pattern file where "pattern" is contained in the concerned files.)

1- If I have the files foo.txt and dir/foo.txt and execute :vimgrep pattern **.txt, only the first file is found. Why?

2- If I have a file foo.txt and execute :vimgrep pattern **/*.txt, the pattern is found in the file. I would have expected only files with a / in its name would match (so only .txt files in subdirectories). Why is the / ignored?

3- ** seems to only match files, not directories. Is that right?

I think I am misunderstanding how the ** wildcard really works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.