-
Notifications
You must be signed in to change notification settings - Fork 126
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
:z4h:fzf-complete recurse-dirs interfers with -g and -/ argument to _files completion #209
Comments
With some further investigation it seems that the filter is correctly applied for files in the current directory but not for "recursive results" (that is: files or directories in sub-directories) Also: having poked around in the code for a bit, I'm going to guess that either something is up with the call to Also also: as There is also a relevant TODO in |
See: zsh4humans/fn/z4h-fzf-complete Lines 85 to 89 in df5c473
It's possible to fix that TODO but it's not trivial. If you need to complete directories, use |
Installing |
Unrelated to this issue but might be relevant to you in general: #35 (comment) and #35 (comment) |
Cool! Are there any other optional dependencies of z4h? Since it is mostly undocumented I assume yes, but it would still be nice to know still.
Hm, if and when I get time I might give that a go. I assume the general idea would be to extract the patterns & ignores into variables that are then used in
Okay, it isn't documented in $ grep -RF '_files -/' /usr/share/zsh | wc -l
474
$ grep -RF '_directories' /usr/share/zsh | wc -l
308 It would be nice if those worked as is. Also _directories is normally implemented in terms of _files (haven't checked if z4h overrides that): $ cat /usr/share/zsh/functions/Completion/Unix/_directories
#compdef dircmp -P -value-,*path,-default-
local expl
_wanted directories expl directory _files -/ "$@" - |
Other optional dependencies are
Applying
This is fixed. |
Would it be feasible/worth it trying to detect when it is possible and do a fast-path using find/bfs flags and a slow path when it isn't possible? Looking at the uses in /usr/share/zsh, in many cases There are absolutely some more complex cases though. Also, ignores seem more difficult in general. |
Yes, definitely. It would also be OK to handle common cases only in the fast path. It might even be better (fast completions with too many options can be preferred to slow completing). That's also how I handled |
Another thought about optimisation (this time for ignore patterns): Looking at However, premature optimisation etc... First implement. Then profile. Then optimise if needed. Not sure if or when I might get around to trying my hands at that. |
The common case is vectorized. This is the code: zsh4humans/fn/-z4h-present-files Lines 123 to 146 in b7fe7f4
It processes all non-symlinks as a vector and only symlinks are processed one by one.
We are on the same page. |
When using the
_files
completer (either directly or as a sub-completer to for example _argument), the-g
and-/
flags to restrict to a glob or directories only doesn't work if:z4h:fzf-complete recurse-dirs
is set to yes.Strangely enough it DOES work if using the underlying _path_files directly, which seems to bypass the
recurse-dirs
style.Example for reproducing:
The same can be observed with
-/
which should only complete directories. I have not tested the other flags to_files
, it is possible they are also bugged.The text was updated successfully, but these errors were encountered: