From f96a900ea3f33868310749aaf4e5a68b3118e621 Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Sat, 5 Mar 2022 19:18:56 +0100 Subject: feat(fzf)!: default to using `fd` before `rg` (#10757) BREAKING CHANGE: if both `fd` and `rg` are installed, default to using `fd`. This is the recommendation of the ripgrep author, and it's been found to be faster. If you want to force using `rg`, set the `FZF_DEFAULT_COMMAND` variable. --- plugins/fzf/README.md | 2 +- plugins/fzf/fzf.plugin.zsh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins/fzf') diff --git a/plugins/fzf/README.md b/plugins/fzf/README.md index 15d4d31f3..beedf4690 100644 --- a/plugins/fzf/README.md +++ b/plugins/fzf/README.md @@ -31,8 +31,8 @@ export FZF_DEFAULT_COMMAND='' If not set, the plugin will try to set it to these, in the order in which they're found: -- [`rg`](https://github.com/BurntSushi/ripgrep) - [`fd`](https://github.com/sharkdp/fd) +- [`rg`](https://github.com/BurntSushi/ripgrep) - [`ag`](https://github.com/ggreer/the_silver_searcher) ### `DISABLE_FZF_AUTO_COMPLETION` diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index 102605958..b86af0d2d 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -191,10 +191,10 @@ fzf_setup_using_openbsd \ 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 -- cgit v1.2.3-70-g09d2 From 4dce175e0e4a678b7f93be80c64247c8f5fbab3e Mon Sep 17 00:00:00 2001 From: Suchandra Thapa Date: Thu, 24 Mar 2022 01:21:36 -1000 Subject: feat(fzf): support `fzf` installed with MacPorts (#10794) --- plugins/fzf/fzf.plugin.zsh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'plugins/fzf') diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index b86af0d2d..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,6 +211,7 @@ 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 -- cgit v1.2.3-70-g09d2