How to open files recursively excluding some directories using args in vim?

309 Views Asked by At

I want to open all files in a directory recursively excluding some subdirectories.

For example, I want to exclude all files under directories named "inbox" in any level.

I can specify which directories I want to include. Is there a way to specify directories I want to exclude?

For example, the following command opens all .md files in all subdirectories:

args **/*.md

I don't want to open any file under any subdirectory called inbox.

1

There are 1 best solutions below

0
edi9999 On

I don't think it is possible to exclude directories/files with the vim glob syntax.

You probably have to use find as an external tool. For example

for i in (split(system("find -name '*.md\' -not -path '*/inbox/*'"),'\n')) | execute("e ".i) | endfor