junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
64.33k stars 2.38k forks source link

FZF_COMPLETION_OPTS to not follow symbolic link on **<TAB> completion being ignored #3778

Closed SadBoiLlama closed 5 months ago

SadBoiLlama commented 5 months ago

Checklist

Output of fzf --version

0.51.0 (260a65b0)

OS

Shell

Problem / Steps to reproduce

trying to use the completion for nvim while in my home dir and steam is installed and has a symbolic link to root i have --walker=file,dir,hidden set in both my default opts and the completion ops and for everything else it works fine but trying to use ls or nvim ** is annoying

junegunn commented 5 months ago

We currently override --walker option because it should be different depending on the command.

https://github.com/junegunn/fzf/blob/4bedd33c593ab0cb750e17c42750048904fdf7fb/shell/completion.bash#L300

If we universally apply --walker=file,dir,hidden, then cd ** will also list files and cat ** will also list directories, and that is not what we want.

The only option at the moment is to define _fzf_compgen_path and _fzf_compgen_dir but that is not ideal because we can't use the built-in walker in that case.

SadBoiLlama commented 5 months ago

is there a way i can have a general case that uses what i want it to use and then only override it for the specific cases already implemented? or if i just change that line can i get the functionality i want? also im using zsh so itd be

[[ $compgen =~ dir ]] && walker=dir,follow || walker=file,dir,follow,hidden

in completion.zsh right?

junegunn commented 5 months ago

One way is to define _fzf_comprun function as shown in the README page. But then you'll have to list all the commands in the function.

We probably need to add $FZF_COMPLETION_PATH_OPTS and $FZF_COMPLETION_DIR_OPTS.

junegunn commented 5 months ago

With cd8d736a9f4074de3aafdf3c10fff75cfb6c5ed0 you can,

FZF_COMPLETION_PATH_OPTS="--walker=file,dir,hidden"
FZF_COMPLETION_DIR_OPTS="--walker=dir,hidden"
SadBoiLlama commented 5 months ago

thank you