summaryrefslogtreecommitdiff
path: root/plugins/fzf/fzf.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/fzf/fzf.plugin.zsh')
-rw-r--r--plugins/fzf/fzf.plugin.zsh33
1 files changed, 30 insertions, 3 deletions
diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
index 102605958..a946cf762 100644
--- a/plugins/fzf/fzf.plugin.zsh
+++ b/plugins/fzf/fzf.plugin.zsh
@@ -173,6 +173,32 @@ function fzf_setup_using_cygwin() {
return 0
}
+function fzf_setup_using_macports() {
+ # If the command is not found, the package isn't installed
+ (( $+commands[fzf] )) || return 1
+
+ # The fzf-zsh-completion package installs the auto-completion in
+ local completions="/opt/local/share/zsh/site-functions/fzf"
+ # The fzf-zsh-completion package installs the key-bindings file in
+ local key_bindings="/opt/local/share/fzf/shell/key-bindings.zsh"
+
+ if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then
+ return 1
+ fi
+
+ # Auto-completion
+ if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
+ source "$completions" 2>/dev/null
+ fi
+
+ # Key bindings
+ if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
+ source "$key_bindings" 2>/dev/null
+ fi
+
+ return 0
+}
+
# Indicate to user that fzf installation not found if nothing worked
function fzf_setup_error() {
cat >&2 <<'EOF'
@@ -185,16 +211,17 @@ fzf_setup_using_openbsd \
|| fzf_setup_using_debian \
|| fzf_setup_using_opensuse \
|| fzf_setup_using_cygwin \
+ || fzf_setup_using_macports \
|| fzf_setup_using_base_dir \
|| fzf_setup_error
unset -f -m 'fzf_setup_*'
if [[ -z "$FZF_DEFAULT_COMMAND" ]]; then
- if (( $+commands[rg] )); then
- export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/*"'
- elif (( $+commands[fd] )); then
+ if (( $+commands[fd] )); then
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
+ elif (( $+commands[rg] )); then
+ export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/*"'
elif (( $+commands[ag] )); then
export FZF_DEFAULT_COMMAND='ag -l --hidden -g "" --ignore .git'
fi