28 lines
887 B
Bash
Executable file
28 lines
887 B
Bash
Executable file
# Determine the FZF path based on the available package manager
|
|
if command -v fzf >/dev/null; then
|
|
FZF_PATH="$(dirname "$(command -v fzf)")"
|
|
elif [[ -x "/run/current-system/sw/bin/fzf" ]]; then
|
|
FZF_PATH="/run/current-system/sw/bin/fzf"
|
|
elif command -v brew >/dev/null; then
|
|
FZF_PATH="$(brew --prefix)/opt/fzf"
|
|
else
|
|
FZF_PATH="/usr/local/opt/fzf"
|
|
fi
|
|
|
|
# Ensure the FZF binary is in the PATH
|
|
if [[ ! "$PATH" == *"$FZF_PATH/bin"* ]]; then
|
|
PATH="${PATH:+${PATH}:}$FZF_PATH/bin"
|
|
fi
|
|
|
|
# Load FZF theme dynamically
|
|
FZF_THEME_FILE="${HOME}/.local/bin/scripts/fzf_theme"
|
|
if [[ -f "$FZF_THEME_FILE" ]]; then
|
|
export FZF_DEFAULT_OPTS="$("$FZF_THEME_FILE")"
|
|
fi
|
|
|
|
# Load fzf key-bindings and completion if available
|
|
if [[ $- == *i* ]]; then
|
|
[[ -f "$HOME/.fzf/key-bindings.zsh" ]] && . "$HOME/.fzf/key-bindings.zsh"
|
|
[[ -f "$HOME/.fzf/completion.zsh" ]] && . "$HOME/.fzf/completion.zsh"
|
|
fi
|
|
|