Aloxaf / fzf-tab

Replace zsh's default completion selection menu with fzf!
MIT License
3.35k stars 97 forks source link

[FR] go back to traditional tab completions when items are less than a threshold #96

Open wfxr opened 4 years ago

wfxr commented 4 years ago

Thanks for your brilliant work!

I find this tool very useful when there are lots of completion items. On the contrary when there are few completion items, such as only 2 or 3, I think traditional complete way is way more consise and fluent.

Could you consider ways to support the mixed completions? When items are less than the threshold go back to traditional simple completion otherwise use fzf-tab completion.

Aloxaf commented 4 years ago

That sounds good. I have implemented it in https://github.com/Aloxaf/fzf-tab/commit/d92299baafdf197c93a88e54f9bbc1c8bb31d427. You can use zstyle ':fzf-tab:*' ignore 3 to set the threshold to 3 now.

Please update and try again.

wfxr commented 4 years ago

@Aloxaf Don't known why but seems I can't use tab to iterate through items like zsh builtin does when fzf not showed.

❯ vim [cursor here]
file_a  file_b  file_c

Only cursor flashed once, no item highlighted and selected when hit tab key.

Minimal config to repro this issue:

autoload -Uz compinit
compinit
zstyle ':fzf-tab:*' ignore 3
source ~/somewhere/fzf-tab.plugin.zsh
Aloxaf commented 4 years ago

A simple fix is set zstyle ':completion:*' menu yes select.

But I'm not sure why this will happen, I will still keep trying to figure out the reason.

wfxr commented 4 years ago

@Aloxaf This workaround works for file completions but not for command option completions:

❯ kubectl rollout status [cursor here, tab not work]
daemonset    deployment   statefulset
lateef-k commented 4 years ago

I think the problem is that fzf-tab still owns the tab key even after calling the original completion widget.