diff options
author | Maxime Brunet <32458727+maxbrunet@users.noreply.github.com> | 2018-09-08 09:31:13 -0400 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2018-09-08 15:31:13 +0200 |
commit | bb908495deae22314c3355235133063087698796 (patch) | |
tree | f7ef7f8dcb69ded436a85d27dd7208d536e373d0 /plugins/fzf/fzf.plugin.zsh | |
parent | f73c29a8203f8df539a72d28763bc5f521b775c0 (diff) | |
download | zsh-bb908495deae22314c3355235133063087698796.tar.gz zsh-bb908495deae22314c3355235133063087698796.tar.bz2 zsh-bb908495deae22314c3355235133063087698796.zip |
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
Diffstat (limited to 'plugins/fzf/fzf.plugin.zsh')
-rw-r--r-- | plugins/fzf/fzf.plugin.zsh | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index b28b97994..27e2d9246 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -24,22 +24,29 @@ fi if [[ -n "${fzf_base}" ]]; then + # Fix fzf shell directory for Archlinux package + if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then + fzf_shell="${fzf_base}" + else + fzf_shell="${fzf_base}/shell" + fi + # Setup fzf # --------- - if [[ ! "$PATH" == *$fzf_base/bin* ]]; then + if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then export PATH="$PATH:$fzf_base/bin" fi # Auto-completion # --------------- if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then - [[ $- == *i* ]] && source "$fzf_base/shell/completion.zsh" 2> /dev/null + [[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null fi # Key bindings # ------------ if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then - source "$fzf_base/shell/key-bindings.zsh" + source "${fzf_shell}/key-bindings.zsh" fi else @@ -47,4 +54,4 @@ else "Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2 fi -unset fzf_base +unset fzf_base fzf_shell dir fzfdirs |