Diff
1diff --git a/plugins/fzf/README.md b/plugins/fzf/README.md
2index b3a434347403fb210d507dec6a9a2466b7ec44b8..d9617563a2c97284a407ca31f0627c144dc88f16 100644
3--- a/plugins/fzf/README.md
4+++ b/plugins/fzf/README.md
5@@ -2,18 +2,32 @@
6
7 This plugin enables [junegunn's fzf](https://github.com/junegunn/fzf) fuzzy auto-completion and key bindings
8
9+To use it, add `fzf` to the plugins array in your zshrc file:
10+```zsh
11+plugins=(... fzf)
12+```
13+
14+## Settings
15+
16+Add these before the `plugins=()` line in your zshrc file:
17+
18 ```zsh
19 # Set fzf installation directory path
20-export FZF_BASE=/path/to/fzf/install/dir
21+# export FZF_BASE=/path/to/fzf/install/dir
22+
23+# Uncomment to set the FZF_DEFAULT_COMMAND
24+# export FZF_DEFAULT_COMMAND='<your fzf default commmand>'
25
26 # Uncomment the following line to disable fuzzy completion
27-# export DISABLE_FZF_AUTO_COMPLETION="true"
28+# DISABLE_FZF_AUTO_COMPLETION="true"
29
30 # Uncomment the following line to disable key bindings (CTRL-T, CTRL-R, ALT-C)
31-# export DISABLE_FZF_KEY_BINDINGS="true"
32-
33-plugins=(
34- ...
35- fzf
36-)
37+# DISABLE_FZF_KEY_BINDINGS="true"
38 ```
39+
40+| Setting | Example value | Description |
41+|-----------------------------|----------------------------|-------------------------------------------------------------|
42+| FZF_BASE | `/path/to/fzf/install/dir` | Set fzf installation directory path (**export**) |
43+| FZF_DEFAULT_COMMAND | `fd --type f` | Set default command to use when input is tty (**export**) |
44+| DISABLE_FZF_AUTO_COMPLETION | `true` | Set whether to load fzf auto-completion |
45+| DISABLE_FZF_KEY_BINDINGS | `true` | Set whether to disable key bindings (CTRL-T, CTRL-R, ALT-C) |
46diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
47index 53bdcbc97f00ffb26b502d18060d3d116973ac22..0b831b7f7e52099b9283a951c2808deecaed8d79 100644
48--- a/plugins/fzf/fzf.plugin.zsh
49+++ b/plugins/fzf/fzf.plugin.zsh
50@@ -98,3 +98,13 @@ function indicate_error() {
51 setup_using_debian_package || setup_using_base_dir || indicate_error
52
53 unset -f setup_using_debian_package setup_using_base_dir indicate_error
54+
55+if [[ -z "$FZF_DEFAULT_COMMAND" ]]; then
56+ if (( $+commands[rg] )); then
57+ export FZF_DEFAULT_COMMAND='rg --files --hidden'
58+ elif (( $+commands[fd] )); then
59+ export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
60+ elif (( $+commands[ag] )); then
61+ export FZF_DEFAULT_COMMAND='ag -l --hidden -g ""'
62+ fi
63+fi