b90f76c1411b4a2182f4fd54b5739be5f78410e8

Author
Ilya Gorski <52842983+gorsil@users.noreply.github.com>
Committer
Ilya Gorski <52842983+gorsil@users.noreply.github.com>
Date

Message

fzf: Adding support for debian packages

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
  2index 27e2d92461650232d2b28669ad674f84d9cb3d83..e191bebbd218bfcda6da6c638310cfa732d11734 100644
  3--- a/plugins/fzf/fzf.plugin.zsh
  4+++ b/plugins/fzf/fzf.plugin.zsh
  5@@ -1,57 +1,93 @@
  6-test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
  7-
  8-if [[ -z "${fzf_base}" ]]; then
  9-  fzfdirs=(
 10-    "${HOME}/.fzf"
 11-    "/usr/local/opt/fzf"
 12-    "/usr/share/fzf"
 13-  )
 14-  for dir in ${fzfdirs}; do
 15-      if [[ -d "${dir}" ]]; then
 16-          fzf_base="${dir}"
 17-          break
 18-      fi
 19-  done
 20-
 21-  if [[ -z "${fzf_base}" ]]; then
 22-      if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
 23-          if [[ -d "${dir}" ]]; then
 24-              fzf_base="${dir}"
 25-          fi
 26-      fi
 27-  fi
 28-fi
 29-
 30-if [[ -n "${fzf_base}" ]]; then
 31-
 32-  # Fix fzf shell directory for Archlinux package
 33-  if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
 34-    fzf_shell="${fzf_base}"
 35-  else
 36-    fzf_shell="${fzf_base}/shell"
 37-  fi
 38-
 39-  # Setup fzf
 40-  # ---------
 41-  if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
 42-    export PATH="$PATH:$fzf_base/bin"
 43-  fi
 44-  
 45-  # Auto-completion
 46-  # ---------------
 47-  if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
 48-    [[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
 49-  fi
 50-  
 51-  # Key bindings
 52-  # ------------
 53-  if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
 54-    source "${fzf_shell}/key-bindings.zsh"
 55-  fi
 56-
 57-else
 58-  print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
 59-        "Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
 60-fi
 61-
 62-unset fzf_base fzf_shell dir fzfdirs
 63+function setup_using_base_dir() {
 64+	# Declare all variables local not no mess with outside env in any way
 65+	local fzf_base
 66+	local fzf_shell
 67+	local fzfdirs
 68+	local dir
 69+
 70+    test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
 71+
 72+    if [[ -z "${fzf_base}" ]]; then
 73+        fzfdirs=(
 74+          "${HOME}/.fzf"
 75+          "/usr/local/opt/fzf"
 76+          "/usr/share/fzf"
 77+        )
 78+        for dir in ${fzfdirs}; do
 79+            if [[ -d "${dir}" ]]; then
 80+                fzf_base="${dir}"
 81+                break
 82+            fi
 83+        done
 84+
 85+        if [[ -z "${fzf_base}" ]]; then
 86+            if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
 87+                if [[ -d "${dir}" ]]; then
 88+                    fzf_base="${dir}"
 89+                fi
 90+            fi
 91+        fi
 92+    fi
 93+
 94+    if [[ -d "${fzf_base}" ]]; then
 95+        # Fix fzf shell directory for Archlinux package
 96+        if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
 97+          fzf_shell="${fzf_base}"
 98+        else
 99+          fzf_shell="${fzf_base}/shell"
100+        fi
101+
102+        # Setup fzf binary path
103+        if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
104+          export PATH="$PATH:$fzf_base/bin"