Aloxaf / fzf-tab

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

[BUG] FZF tab completion does not activate on similar file names #470

Closed ItzYeho closed 1 week ago

ItzYeho commented 3 weeks ago

Describe the bug

When trying to complete entries that have the same starting substring, fzf completion will not be triggered, and thus only a regular zsh menu completion is possible. This is unlike lincheney's solution which works flawlessly, but lacks features that I need.

I can make sure:

To Reproduce

Steps to reproduce the behavior:

  1. Create an empty directory, and create in it two files with identical starting names. For instance:
    mkdir test
    touch aaae
    touch aaad
  2. Go inside the directory, type cat and press Tab

Expected behavior

FZF is opened and I am able to complete what I want.

Screenshots

image

How it should be: image

Environment:

Minimal zshrc

# Completion engine settings
zstyle ':completion:*' completer _oldlist _expand _complete _ignored _match _correct _approximate _prefix
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*'
zstyle ':completion:*' menu select

# Load completions engine
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zinit cdreplay -q

# Load FZF-tab
zinit light Aloxaf/fzf-tab

Log

Aloxaf/fzf-tab image

lincheney/fzf-tab-completion image

fzf builtin completion image

Aloxaf commented 1 week ago

Just set zstyle ':completion:*' menu no

ItzYeho commented 1 week ago

Nope, this does not fix it. This only makes it worse by making it unable to select a non-fzf completion if this bug does occur.

Aloxaf commented 1 week ago

Oh, I didn't read the code carefully. You use many custom completers, which may cause bug (eg. https://github.com/Aloxaf/fzf-tab/issues/56).

I tested your configuration and removing _oldlist can fix it.

ItzYeho commented 6 days ago

That works! But I don't think it's an ideal solution. Ideally fzf-tab should work in all of the default completers offered by zsh. As I've mentioned in the issue, lincheney's solution does indeed manage to hook the _oldlist request.