Skip to content

Commit

Permalink
fzf: Fix shell directory for archlinux package (ohmyzsh#7119)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
maxbrunet authored and lewg committed Oct 28, 2019
1 parent 972438e commit 427006c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions plugins/fzf/fzf.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,34 @@ 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
print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
"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

0 comments on commit 427006c

Please sign in to comment.