From 9edcaa15971e4b0a18f886f8ba5263e4135f1fe0 Mon Sep 17 00:00:00 2001 From: alvinlollo <143326475+alvinlollo@users.noreply.github.com> Date: Sat, 8 Nov 2025 23:03:01 +1100 Subject: [PATCH] Create default fzf config for zsh --- configs/.fzf.zsh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 configs/.fzf.zsh diff --git a/configs/.fzf.zsh b/configs/.fzf.zsh new file mode 100644 index 0000000..a18d61e --- /dev/null +++ b/configs/.fzf.zsh @@ -0,0 +1,36 @@ +# Setup fzf +# --------- +if [[ ! "$PATH" == *${FZF_PATH}/bin* ]]; then + export PATH="$PATH:${FZF_PATH}/bin" +fi + +function _fzf_settings_has() { + which "$@" > /dev/null 2>&1 +} + +if _fzf_settings_has brew; then + # If fzf was installed via brew, use the brew paths + if [[ -x "$(brew --prefix)/bin/fzf" ]]; then + if [[ -f "$(brew --prefix fzf)/shell/completion.zsh" ]]; then + source "$(brew --prefix fzf)/shell/completion.zsh" 2> /dev/null + fi + if [[ -f "$(brew --prefix fzf)/shell/key-bindings.zsh" ]]; then + source "$(brew --prefix fzf)/shell/key-bindings.zsh" + fi + fi +fi + +# Auto-completion +# --------------- +if [[ -f "${FZF_PATH}/shell/completion.zsh" ]]; then + [[ $- == *i* ]] && source "${FZF_PATH}/shell/completion.zsh" 2> /dev/null +fi + +# Key bindings +# ------------ +if [[ -f "${FZF_PATH}/shell/key-bindings.zsh" ]]; then + source "${FZF_PATH}/shell/key-bindings.zsh" +fi + +# Cleanup internal functions +unset -f _fzf_settings_has