Closed pjhfggij closed 1 week ago
for example,
cd <TAB>
doesn't invoke fzf
Try
cd ** <TAB>
or modify FZF_COMPLETION_TRIGGER
[^1]
export FZF_COMPLETION_TRIGGER=""
cd <TAB>
Thank you @LangLangBart that works. I came across this video in the meantime that mentions FZF_COMPLETION_TRIGGER
as well, but I would struggle to find out whether setting it to an empty string is a supported use case. I couldn't find it set explicitly in my current zsh framework (z4h), so thank you.
Can I ask you by the way if you know how to set it to also fuzzy search completion of command line arguments? It doesn't seem to work right now when I try to get information on ls
flags for example:
ls -<TAB>
but it also didn't work when I tried:
ls -**<TAB>
so is it not supported out of the box by fzf's completion.zsh
script?
also is there a list of completions that fzf-completion
supports? kill is supported for example (kill <TAB>
), but variables don't seem to work (echo $FZF_<TAB>
)
zsh framework (z4h),
I use zsh4humans
as well, what is the output of the following command ?
bindkey | grep -F '^I'
try
z4h bindkey z4h-fzf-complete Tab
sorry, I've used z4h on the previous machine, but I'm trying to write .zshrc from scratch now (hence confusion)
on z4h Tab triggers fzf completion out of the box, but when sourcing fzf zsh scripts without any framework, while export FZF_COMPLETION_TRIGGER=""
does work for path completions (e.g. cd <TAB>
) it still doesn't seem to complete in some contexts that worked in z4h (e.g. echo $FZF_<TAB>
or ls -<TAB>
mentioned above)
The completion widget from zsh4humans
goes much further with its functionality, allowing for the things you desire, like completion of env variables and CLI arguments.
The fzf
completion widget is kept minimal for a reason.
Related comment by the maintainer:
There is some customization one can easily do for additional commands, for example doge
[^1].
But completion of environment variables or CLI arguments seems to require more changes to the actual *zsh
file. Usually, one has to write it themselves or use popular plugins.
Perfect, thank you. That explains a lot. The lines between the z4h framework and fzf weren't clear to me until now.
I will see if it will be worth installing something like fzf-tab to compensate for missing completions.
I've also noticed that export FZF_COMPLETION_TRIGGER=""
now breaks some zsh completions - instead of listing the usual completions on ls -<TAB>
for example fzf kicks in showing file names (instead of flags and their explanations).
One might argue though that ls --help | fzf
would yield the same or even better result. So I might just stay with vanilla fzf's completion.zsh in the end
I've decided to give fzf-tab a try - the author seems to have thought the problem through well and the first attempts at running it showed a lot of desirable properties (straightforward frontend to the zsh's default compsys; simple zsh codebase). Maybe it will turn out not to be as "robust" as completion integration in zsh4humans, but fingers crossed it will work for my use cases.
Checklist
man fzf
)Output of
fzf --version
0.53.0 (c4a9ccd6)
OS
Shell
Problem / Steps to reproduce
invoking fzf-completion yields zsh's vanilla menu instead of fzf fuzzy search menu. fzf-history-widget and fzf-file-widget work fine.
for example,
cd <TAB>
doesn't invoke fzf, butctrl r
andctrl t
do. .zshrc: