-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Suggestion for documentation #1067
Comments
Thanks for the suggestion. You're right that I like how you implemented Note that ripgrep may not be a good choice until a new version is released. See BurntSushi/ripgrep#200 |
I posted the same snippet into a Given that you currently use |
@junegunn Check it out, this
Edit Got help from #awk to rewrite as a single awk statement |
@chrisjohnson How about:
|
Yep that's what I meant, that's what #awk suggested. But I'm currently investigating that the number of results that comes back is the same -- it seems like it does not. I need to wrap up some work but I'll paste results later |
They're a bit different. I think in your snippet this:
should have a $1, not a $0. |
Yep typo on my paste here. I fixed that. But it looks like the logic to use awk to find dirname doesn't match up with I get a different word count only for the 2 awk approaches that use awk to get the dirname |
After diffing I can see it's because the awk snippet for grabbing the dirname doesn't handle filenames with no dir before them, so .foo/bar returns .foo but .foobar just returns .foobar. Here's an approach that #awk helped me put together, which is fast and has the correct number of results. The downside is that it's a bit long. But after consideration it's the only dirname implementation I have come across that actually resembles the behavior of
|
Given your thumb I made a PR with this final version |
This isn't a bug, just a suggestion for the documentation. Right now, in the settings section, you mention a solution to use ag for
_fzf_compgen_path
and call out the fact that ag only works on files not directories. This is great because by default path and dir globbing in homedir take a long time on my machine with tons of files, and being able to use a.ignore
would greatly improve that. However, it doesn't solve the issue for dir globbing.I would propose adding the following function definition (or a comparable ag definition) to also work for directory completion:
I found the suggestion in ripgrep's issues and they proposed using
| uniq
instead of this awk command, but uniq requires duplicates to be adjacent to one another, which results in duplicate results. I tried prepending| sort
which removes duplicates but makes the command take about 3x longer. Finally I stumbled on this awk snippet which doesn't require the duplicates to be adjacent, and has the happy benefit of actually being a decent bit faster than the| uniq
approach.Note: For anybody reading this, you need to use
gdirname
from the coreutils homebrew package on OS X instead of dirname. I used this block to determine which dirname to use:I understand this dirname business is probably too much for the fzf documentation though
The text was updated successfully, but these errors were encountered: