Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#49951 - [fzf] Fuzzy completion script installed to incorrect location

Attached to Project: Community Packages
Opened by Hermann Zahnweh (eigengrau) - Tuesday, 05 July 2016, 06:48 GMT
Last edited by Pierre Neidhardt (Ambrevar) - Monday, 11 July 2016, 08:27 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Pierre Neidhardt (Ambrevar)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

fzf ships a file named completion.zsh. Our package installs this file into the
Zsh completion directory. However, the file does *not* define any compdefs at
all. Rather, it includes a script with one keybinding, which must be sourced
manually. As such, completion.zsh should also be installed under /usr/share/fzf.

Note that, afaict, this is not true of completion.bash, which actually seems to
use the Bash builtin completion system.


Additional info:

* fzf 0.13.2-1
This task depends upon

Closed by  Pierre Neidhardt (Ambrevar)
Monday, 11 July 2016, 08:27 GMT
Reason for closing:  Fixed
Comment by Pierre Neidhardt (Ambrevar) - Tuesday, 05 July 2016, 15:56 GMT
Well, the completion file works for me: Zsh should parse anything in this folder, whether it has a compdef or not.
I wonder why you have to source it manually. Can you confirm?

It looks like fzf is not using the conventional completion system but binding on TAB instead, for whatever reason.
I don't know if this is considered bad practice for Zsh.
Comment by Hermann Zahnweh (eigengrau) - Wednesday, 06 July 2016, 07:45 GMT
Hi Pierre!

> Well, the completion file works for me: Zsh should parse anything in this folder, whether it has a compdef or not.

Can you confirm that the file really works for you? Zsh doesn’t automatically *source* stuff from that directory. It’s just meant for autoloaded *functions*, which are either declared via the autoload builtin, or by adding an autoload tag to the first line of the file. In any case, fzf’s completion.zsh does not contain an autoloaded function. You can confirm this via `which fzf-completion`. The way fzf is currently packaged, you should get `fzf-completion not found`.

completion.zsh is a bad choice for the filename, so it’s an easy mistake to make. What completion.zsh does is define a ZLE widget (*not* a completion command) and binds the widget to the TAB key. The widget will be triggered when you end a command line with `**<TAB>`. You can see that the currently packaged version doesn’t enable this by doing `ls /tmp/**<TAB>`. If you just get the expanded filenames, then it’s not working. completion.zsh will instead open fzf. Same thing for `ssh **`, where it should show an fzf dialog listing all your SSH hosts.

completion.zsh is meant to be sourced from the user’s config, in the same way keybindings.zsh is meant to be sourced. It’s just an additional widget and a keybinding, not a command completion for the fzf command.

Best regards,
Comment by Pierre Neidhardt (Ambrevar) - Wednesday, 06 July 2016, 16:47 GMT
My bad, you were right. Explanation: the previous maintainers of the package included a patch to automatically parse the completion file when the keybindings are loaded.
I don't like tangling configuration together and I'd prefer to separate keybindings from completion, which would also follow your recommendation.

Does anybody see a reason to keep the patch?
Comment by Hermann Zahnweh (eigengrau) - Saturday, 09 July 2016, 10:26 GMT
Ah, I see. I didn’t look at the PKGBUILD, this might have alleviated the confusion. The patch is a bit odd. I’d opt for dropping it. «auto-complete.zsh» doesn’t really belong in the site-functions directory anyway. I’d just install it to /usr/share/fzf along with the other keybinding script. Users can then choose to source whichever parts they want (e.g., some people might want to source the default keybindings, but not use the «**-TAB» thing, which is more intrusive than the other bindings).
Comment by Pierre Neidhardt (Ambrevar) - Saturday, 09 July 2016, 18:06 GMT
Agreed. I'll commit your recommendation soon unless somebody comes with a better offer.

Loading...