'zsh fzf search path is strange on Mac
I installed fzf for the zsh on my Mac
I usecd ** <Tab> , instead of getting a list of directories which can get into
I always get a long list of directories,such as
How to solve this problem?
when I search specific file, it always return a list of library container files of Mac file system, how to ignore them and just leave the real one.
it takes a very long time to get the top1 real result

BTW the first line numbers
seems going infinite, why is that.
Solution 1:[1]
fzf default command search every files in your home diretory and follow every symbol links e.g. ~/Library/Container/*/Downloads which return files multi times.
According to the readme of fzf, you can specify FZF_DEFAULT_COMMAND and _fzf_compgen_path() _fzf_compgen_dir() to exclude directories what you don't want to see.
# Use fd (https://github.com/sharkdp/fd) instead of the default find
# remove -L of fzf default command
# export FZF_DEFAULT_COMMAND="find . -mindepth 1 -path '*/\.*\' -prune -o -type f -print -o -type l -print 2> /dev/null | cut -b3-"
export FZF_DEFAULT_COMMAND='fd --type f'
_fzf_compgen_path() {
fd --hidden --follow --exclude ".git" . "$1"
}
# Use fd to generate the list for directory completion
_fzf_compgen_dir() {
fd --type d --hidden --follow --exclude ".git" . "$1"
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tianshu Wang |

