Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to make --files -g recurse into subdirectories? #436

Closed
jmatraszek opened this issue Apr 2, 2017 · 2 comments
Closed

Is there a way to make --files -g recurse into subdirectories? #436

jmatraszek opened this issue Apr 2, 2017 · 2 comments

Comments

@jmatraszek
Copy link

As suggested in #284 I am opening a new issue.

Using linux repo: there are almost 60k files there (find | wc -l reports 59 296).

ag -g '' reports 55 292 files and takes 0.8 second. This is the command that will be run by Unite plugin to collect the initial matches.

rg --files -g *''* reports 8 files (just the top-level files). So, let's try some other glob: rg --files -g **/*''* reports 965 (files inside top-level directories only). The only way to make rg return all files from the directory is to use shopt -s globstar, then rg --files -g *''* will return all files that should be returned, but it will take 3-4 seconds to run.

This wouldn't be that bad if Unite used this command on each pattern that is entered in its window (ag -g 'Makefile' and rg --files -g *'Makefile'* return (more or less) the same list of files). The problem is that it collects the initial list of files using this command, then just filters it for matches (so using rg only 8 files will be available to choose at the beginning and then, after typing Makefile as the pattern, one file: top-level Makefile).

So, is there a way to make rg recurse into directories (other than enabling globstar)?

P.S. Not a high-priority, I can always fallback to using find/ag in Unite. :) Thanks!

@BurntSushi
Copy link
Owner

Why can't you just use rg --files?

@jmatraszek
Copy link
Author

Wow, this was so simple that I haven't thought of it! xD Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants