010c36d4ab0b6f9037a278c39ed6d41586f25843

Author
Logan Linn <logan@loganlinn.com>
Committer
GitHub <noreply@github.com>
Date

Message

refactor(fzf): adopt code style and simplify function naming (#10514)

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
  2index aabd62cb129be157eb57bbafe0f617151e145009..50712cbee6c4fb8b9ca1ad91b5f24cf1cf710171 100644
  3--- a/plugins/fzf/fzf.plugin.zsh
  4+++ b/plugins/fzf/fzf.plugin.zsh
  5@@ -1,176 +1,176 @@
  6-function setup_using_base_dir() {
  7-    local fzf_base fzf_shell fzfdirs dir
  8-
  9-    test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
 10+function fzf_setup_using_base_dir() {
 11+  local fzf_base fzf_shell fzfdirs dir
 12+
 13+  test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
 14+
 15+  if [[ -z "${fzf_base}" ]]; then
 16+    fzfdirs=(
 17+      "${HOME}/.fzf"
 18+      "${HOME}/.nix-profile/share/fzf"
 19+      "${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
 20+      "/usr/local/opt/fzf"
 21+      "/usr/share/fzf"
 22+      "/usr/local/share/examples/fzf"
 23+    )
 24+    for dir in ${fzfdirs}; do
 25+      if [[ -d "${dir}" ]]; then
 26+        fzf_base="${dir}"
 27+        break
 28+      fi
 29+    done
 30 
 31     if [[ -z "${fzf_base}" ]]; then
 32-        fzfdirs=(
 33-          "${HOME}/.fzf"
 34-          "${HOME}/.nix-profile/share/fzf"
 35-          "${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
 36-          "/usr/local/opt/fzf"
 37-          "/usr/share/fzf"
 38-          "/usr/local/share/examples/fzf"
 39-        )
 40-        for dir in ${fzfdirs}; do
 41-            if [[ -d "${dir}" ]]; then
 42-                fzf_base="${dir}"
 43-                break
 44-            fi
 45-        done
 46-
 47-        if [[ -z "${fzf_base}" ]]; then
 48-            if (( ${+commands[fzf-share]} )) && dir="$(fzf-share)" && [[ -d "${dir}" ]]; then
 49-                fzf_base="${dir}"
 50-            elif (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
 51-                if [[ -d "${dir}" ]]; then
 52-                    fzf_base="${dir}"
 53-                fi
 54-            fi
 55+      if (( ${+commands[fzf-share]} )) && dir="$(fzf-share)" && [[ -d "${dir}" ]]; then
 56+        fzf_base="${dir}"
 57+      elif (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
 58+        if [[ -d "${dir}" ]]; then
 59+          fzf_base="${dir}"
 60         fi
 61-    fi
 62-
 63-    if [[ ! -d "${fzf_base}" ]]; then
 64-        return 1
 65-    fi
 66-
 67-    # Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages
 68-    if [[ ! -d "${fzf_base}/shell" ]]; then
 69-        fzf_shell="${fzf_base}"
 70-    else
 71-        fzf_shell="${fzf_base}/shell"
 72-    fi
 73-
 74-    # Setup fzf binary path
 75-    if (( ! ${+commands[fzf]} )) && [[ "$PATH" != *$fzf_base/bin* ]]; then
 76-        export PATH="$PATH:$fzf_base/bin"
 77-    fi
 78-
 79-    # Auto-completion
 80-    if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
 81-        source "${fzf_shell}/completion.zsh" 2> /dev/null
 82-    fi
 83-
 84-    # Key bindings
 85-    if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
 86-        source "${fzf_shell}/key-bindings.zsh"
 87-    fi
 88+      fi
 89+    fi
 90+  fi
 91+
 92+  if [[ ! -d "${fzf_base}" ]]; then
 93+    return 1
 94+  fi
 95+
 96+  # Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages
 97+  if [[ ! -d "${fzf_base}/shell" ]]; then
 98+    fzf_shell="${fzf_base}"
 99+  else
100+    fzf_shell="${fzf_base}/shell"
101+  fi
102+
103+  # Setup fzf binary path
104+  if (( ! ${+commands[fzf]} )) && [[ "$PATH" != *$fzf_base/bin* ]]; then