Maxime Brunet <32458727+maxbrunet@users.noreply.github.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date
Message
fzf: Fix shell directory for archlinux package (#7119)
* fzf: Fix shell directory for archlinux package
* fzf: Don't clutter PATH if fzf already available
* brew has it available via symlink in /usr/local/bin
* Fedora and Arch packages have it place in /usr/bin
* fzf: Fix archlinux guess by using release file
* fzf: unset leftover variables
Diff
1diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
2index b28b9799401ec6d88a2d068d5f06fd474c44b784..27e2d92461650232d2b28669ad674f84d9cb3d83 100644
3--- a/plugins/fzf/fzf.plugin.zsh
4+++ b/plugins/fzf/fzf.plugin.zsh
5@@ -24,22 +24,29 @@ fi
6 7 if [[ -n "${fzf_base}" ]]; then
8 9+ # Fix fzf shell directory for Archlinux package
10+ if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
11+ fzf_shell="${fzf_base}"
12+ else
13+ fzf_shell="${fzf_base}/shell"
14+ fi
15+
16 # Setup fzf
17 # ---------
18- if [[ ! "$PATH" == *$fzf_base/bin* ]]; then
19+ if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
20 export PATH="$PATH:$fzf_base/bin"
21 fi
2223 # Auto-completion
24 # ---------------
25 if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
26- [[ $- == *i* ]] && source "$fzf_base/shell/completion.zsh" 2> /dev/null
27+ [[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
28 fi
2930 # Key bindings
31 # ------------
32 if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
33- source "$fzf_base/shell/key-bindings.zsh"
34+ source "${fzf_shell}/key-bindings.zsh"
35 fi
3637 else
38@@ -47,4 +54,4 @@ else
39 "Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
40 fi
4142-unset fzf_base
43+unset fzf_base fzf_shell dir fzfdirs