Fix FZF integration in to ZSH

This commit is contained in:
Fabio Scotto di Santolo
2025-07-25 09:20:32 +02:00
parent 600b31a5ad
commit 927e0cbb56
2 changed files with 29 additions and 34 deletions

27
zsh/.profile.d/fzf.sh Normal file → Executable file
View File

@@ -1,8 +1,31 @@
#!/usr/bin/env bash
is_debian_based() {
# Checking /etc/os-release
if [[ -f /etc/os-release ]]; then
. /etc/os-release
if [[ "$ID_LIKE" == *"debian"* ]] || [[ "$ID" == "debian" ]]; then
return 0 # OK: Debian-based
fi
fi
# Alternative check: /etc/debian_version
if [[ -f /etc/debian_version ]]; then
return 0 # OK: Debian-based
fi
return 1 # NO Debian-based
}
# Add fzf keybindings and enhancements
export FZF_CTRL_T_COMMAND="fd --type f"
export FZF_ALT_C_COMMAND="fd --type d"
if is_debian_based; then
export FZF_CTRL_T_COMMAND="fdfind --type f"
export FZF_ALT_C_COMMAND="fdfind --type d"
else
export FZF_CTRL_T_COMMAND="fd --type f"
export FZF_ALT_C_COMMAND="fd --type d"
fi
export FZF_CTRL_R_OPTS="--preview 'echo {}'"
# Export Catppuccin Mocha theme for FZF