Open barlik opened 6 years ago
I see, do you know how to fix it?
Yes, I can. However, I've been looking into fzf completions yesterday and thinking about a different approach for it.
FZF completions are currently duplicating some code that's already defined inside bash completions. For example, in fzf when you expand '**' it triggers a fzf defined shell function to prepare a list of hosts to complete. This function is however not identical to the the bash's one. E.g. in bash I use HOSTFILE to add additional hosts for the host completion. This is missing from the fzf '**' completion. The situation is the same with other commands (e.g. kill command doesn't complete signals).
I think that an alternative way to approach completions might be to leverage the existing completions and use fzf to filter those. It would work like this:
ssh -i ** -> completion of files with fzf
ssh -l ** -> completion of users with fzf
ssh -c ** -> completion of crypto algorithms with fzf
By leveraging the existing completions you can:
<tab>
you can have fzf be applied to all completions. This is quite amazing.I've tried that with a proof of concept ssh completion and it works great. The code is in the early stage, it's just a proof of concept as of now. It triggers the existing completion and then it uses fzf to select the item from the completion list. Hopefully, I'll find a bit more time to finish it in the next couple of days. It might work as a replacement or an alternative to the current completions.
Cool, love the idea!
that's already defined inside bash completions
Only if you installed custom bash completions such as the one you linked above. We can leverage those external completions, but we still have to use our functions when alternatives are not found.
I would love to use the bash-native list of hosts for completion through fzf. Any chance you still have your proof of concept to share? It looks like #1149 might be it.
I have standard bash completions installed (https://github.com/scop/bash-completion) and it includes a way to complete signal names for kill command by running:
After adding fzf completions, this no longer works. Kill command completion from FZF package only completes PIDs and it doesn't fall-back to previously defined completion.