f96a900ea3f33868310749aaf4e5a68b3118e621

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

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.

Diff

 1diff --git a/plugins/fzf/README.md b/plugins/fzf/README.md
 2index 15d4d31f39a29178b2b47be818bae5425a8c30b2..beedf4690993ae12b83fdf80e0a3889c2e9dfec9 100644
 3--- a/plugins/fzf/README.md
 4+++ b/plugins/fzf/README.md
 5@@ -31,8 +31,8 @@ export FZF_DEFAULT_COMMAND='<your fzf default command>'
 6 
 7 If not set, the plugin will try to set it to these, in the order in which they're found:
 8 
 9-- [`rg`](https://github.com/BurntSushi/ripgrep)
10 - [`fd`](https://github.com/sharkdp/fd)
11+- [`rg`](https://github.com/BurntSushi/ripgrep)
12 - [`ag`](https://github.com/ggreer/the_silver_searcher)
13 
14 ### `DISABLE_FZF_AUTO_COMPLETION`
15diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
16index 1026059588f09d6ba5c891011684928b9116a288..b86af0d2d1fec588274972c9cd79020047af28b1 100644
17--- a/plugins/fzf/fzf.plugin.zsh
18+++ b/plugins/fzf/fzf.plugin.zsh
19@@ -191,10 +191,10 @@ fzf_setup_using_openbsd \
20 unset -f -m 'fzf_setup_*'
21 
22 if [[ -z "$FZF_DEFAULT_COMMAND" ]]; then
23-  if (( $+commands[rg] )); then
24-    export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/*"'
25-  elif (( $+commands[fd] )); then
26+  if (( $+commands[fd] )); then
27     export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
28+  elif (( $+commands[rg] )); then
29+    export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/*"'
30   elif (( $+commands[ag] )); then
31     export FZF_DEFAULT_COMMAND='ag -l --hidden -g "" --ignore .git'
32   fi