junegunn/fzf

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

Closed this issue · 5 comments

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.51.0 (260a65b)

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

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

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

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

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.

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?

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.

With cd8d736 you can,

FZF_COMPLETION_PATH_OPTS="--walker=file,dir,hidden"
FZF_COMPLETION_DIR_OPTS="--walker=dir,hidden"

thank you