From d0fb84b8f73b366ae91ccad4e96f090069fb81a5 Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Thu, 16 Jan 2025 11:45:54 -0800 Subject: [PATCH] Move fzf shell integrations --- assets/default/dotfiles/bash_profile | 20 ++++++++++++++++++++ assets/default/dotfiles/zshrc | 20 +++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/assets/default/dotfiles/bash_profile b/assets/default/dotfiles/bash_profile index a3cb1bd..1c1dbe1 100644 --- a/assets/default/dotfiles/bash_profile +++ b/assets/default/dotfiles/bash_profile @@ -89,6 +89,26 @@ if fc-list -q 'Symbols Nerd Font'; then export TERM_NERD_FONT=1 fi +# FZF +if[ -f ~/.fzf.bash ]; then + source ~/.fzf.bash +elif fzf --bash &> /dev/null; then + source <(fzf --bash) +else + if [ -d /opt/local/share/fzf/shell ]; then + fzf_shell_path=/opt/local/share/fzf/shell + elif [ -d /usr/share/doc/fzf/examples/ ]; then + fzf_shell_path=/usr/share/doc/fzf/examples + fi + + if [ -n "$fzf_shell_path" ]; then + # Auto-completion + [[ $- == *i* ]] && source $fzf_shell_path/completion.bash 2> /dev/null + + # Key bindings + source $fzf_shell_path/key-bindings.bash + end +fi if type rg &> /dev/null; then export FZF_DEFAULT_COMMAND='rg --files' # export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden' diff --git a/assets/default/dotfiles/zshrc b/assets/default/dotfiles/zshrc index 8513b4a..9e5e58b 100644 --- a/assets/default/dotfiles/zshrc +++ b/assets/default/dotfiles/zshrc @@ -161,7 +161,25 @@ if fc-list -q 'Symbols Nerd Font'; then fi # FZF -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh +if [ -f ~/.fzf.zsh ]; then + source ~/.fzf.zsh +elif fzf --zsh 2&> /dev/null; then + source <(fzf --zsh) +else + if [ -d /opt/local/share/fzf/shell ]; then + fzf_shell_path=/opt/local/share/fzf/shell + elif [ -d /usr/share/doc/fzf/examples/ ]; then + fzf_shell_path=/usr/share/doc/fzf/examples + fi + + if [ -n "$fzf_shell_path" ]; then + # Auto-completion + [[ $- == *i* ]] && source $fzf_shell_path/completion.zsh 2> /dev/null + + # Key bindings + source $fzf_shell_path/key-bindings.zsh + fi +fi if type rg &> /dev/null; then export FZF_DEFAULT_COMMAND='rg --files' # export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden'