From 4f182e9108d678c6dad2668df3e8a35fbc08e9b9 Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Sun, 15 Nov 2020 01:20:42 +0100 Subject: [PATCH] fzf: Use rg instead of find when installed Use rg as it respects possible gitignores. --- .config/zsh/.zprofile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index f5cbcc4..1e81601 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -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