fzf-tab-completion
fzf-tab-completion copied to clipboard
Cannot expand asterisk anymore
When the plugin is on, pressing tab after asterisk no longer expands to matching files. For example, typing rm *
and then pressing Tab doesn't do anything (besides making highlighting being lost).
Then without the plugin it correctly expands to matching files inline.
Which shell are you experiencing this on? bash or zsh or both?
ZSH. I haven't tested with Bash.
Same thing happens with bash, I've found out that this is caused by the line
bind -x '"\t": fzf_bash_completion'
When this is set, pressing Tab after **
doesn't expand the standard fzf fuzzy completion properly (doesn't use the custom command we could set using _fzf_compgen_dir for example).
the bash case should be fixed by https://github.com/lincheney/fzf-tab-completion/commit/f5788de131f3d03cb3475f085e164ee10f8fc5d5
for zsh, I'm not able to replicate
doing rm *<tab>
opens fzf with many results (1 result for each file + 1 result that has all files + 1 result which is a *
)
I have the same problem and could reproduce it in a vanilla shell (zsh -dfi
) by executing:
source <fzf-zsh-completion.sh>
bindkey '^I' fzf_completion
autoload -Uz compinit
compinit -d /tmp/zcompdump
# fzf completion now works, asterisk expansion does not:
echo *<Tab>
I have the same problem and could reproduce it in a vanilla shell (zsh -dfi) by executing:
Thanks 👍 I can indeed reproduce the issue using this. I'll have a look to see why this is happening
Ok, I think what is happening is that with default zsh, tab is bound to expand-or-complete
fzf-tab-completion is able to do the "complete", but it is actually the "expand" that is giving out the results which we are not doing as it is not part of the usual completion mechanism
(to compare, if I also put in bindkey '^I' menu-complete
, this also does not "expand" echo *
)
I'll need to see how to emulate this, maybe using the _expand
completer
I've made following changes https://github.com/lincheney/fzf-tab-completion/compare/1ec392c710215cfa45078d2b5b469c6119e89fb0..f0f3facf9f5ae2e1896d88e1988608e67acf49e0 which appear to make the expand work for me If anyone wants to try it out on their end too
It works in a default shell but not with my customisations though. In my customised shell, it shows an fzf prompt with the expansion targets as source. Do you have any idea what might cause this behaviour?
What do you mean with the expansion targets as source
?
Something like this?
Have you turned on the
_expand
completer? It will "expand" globs etc into completion matches for you.
e.g. in my zshrc I have this line: zstyle ':completion:*' completer _expand _complete _ignored _match _correct _approximate _prefix
I mean this (like in your screenshot but without the last two lines):
I expect the tab key to not show the fzf prompt, but expand the asterisk like in default zsh.
No, I haven't enabled the _expand
completer.
ah i think i implemented it in the wrong order, it should expand then complete, but i've made it complete then expand, need to fix it
I've pushed https://github.com/lincheney/fzf-tab-completion/commit/1d596ebea90e7fab18892ceb7af013794aad5c4d which I think this should fix it, are you able to test it out?
Works perfectly :smiley:
Awesome, thanks for your help on this one!