fzf: Use rg instead of find when installed

Use rg as it respects possible gitignores.
This commit is contained in:
2020-11-15 01:20:42 +01:00
parent af49c39ba3
commit 4f182e9108

View File

@@ -57,7 +57,12 @@ else
fi
# Show also hidden files per default but ignore files in '.git' directories.
FZF_DEFAULT_COMMAND="find . -name '.git' -prune -o \( -type f -a -print \)"
if command -v rg &>/dev/null; then
# Also respect gitignores
FZF_DEFAULT_COMMAND="rg --hidden --files -g '!.git'"
else
FZF_DEFAULT_COMMAND="find . -name '.git' -prune -o \( -type f -a -print \)"
fi
export FZF_DEFAULT_COMMAND
# Setup LS_COLORS