Suggest ripgrep instead of the silver searcher

Since https://github.com/BurntSushi/ripgrep/issues/200 is fixed in
0.7.1, we can safely suggest ripgrep as the candidate generator as it
has a more precise implementation of gitignore filtering than the silver
searcher.
This commit is contained in:
Junegunn Choi 2017-10-23 13:19:10 +09:00
parent eaf6eb8978
commit 5784101bea
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -231,7 +231,7 @@ or `py`.
- `FZF_DEFAULT_COMMAND` - `FZF_DEFAULT_COMMAND`
- Default command to use when input is tty - Default command to use when input is tty
- e.g. `export FZF_DEFAULT_COMMAND='ag -g ""'` - e.g. `export FZF_DEFAULT_COMMAND='rg --files'`
- `FZF_DEFAULT_OPTS` - `FZF_DEFAULT_OPTS`
- Default options - Default options
- e.g. `export FZF_DEFAULT_OPTS="--reverse --inline-info"` - e.g. `export FZF_DEFAULT_OPTS="--reverse --inline-info"`
@ -369,17 +369,18 @@ export FZF_COMPLETION_TRIGGER='~~'
# Options to fzf command # Options to fzf command
export FZF_COMPLETION_OPTS='+c -x' export FZF_COMPLETION_OPTS='+c -x'
# Use ag instead of the default find command for listing path candidates. # Use rg (https://github.com/BurntSushi/ripgrep) instead of the default find
# command for listing path candidates.
# - The first argument to the function is the base path to start traversal # - The first argument to the function is the base path to start traversal
# - See the source code (completion.{bash,zsh}) for the details. # - See the source code (completion.{bash,zsh}) for the details.
# - ag only lists files, so we use with-dir script to augment the output # - rg only lists files, so we use with-dir script to augment the output
_fzf_compgen_path() { _fzf_compgen_path() {
ag -g "" "$1" | with-dir "$1" rg --files "$1" | with-dir "$1"
} }
# Use ag to generate the list for directory completion # Use rg to generate the list for directory completion
_fzf_compgen_dir() { _fzf_compgen_dir() {
ag -g "" "$1" | only-dir "$1" rg --files "$1" | only-dir "$1"
} }
``` ```
@ -491,18 +492,17 @@ Tips
#### Respecting `.gitignore`, `.hgignore`, and `svn:ignore` #### Respecting `.gitignore`, `.hgignore`, and `svn:ignore`
[ag](https://github.com/ggreer/the_silver_searcher) or [ripgrep](https://github.com/BurntSushi/ripgrep) or [the silver
[rg](https://github.com/BurntSushi/ripgrep) will do the searcher](https://github.com/ggreer/the_silver_searcher) can do the filtering:
filtering:
```sh ```sh
# Feed the output of ag into fzf # Feed the output of rg into fzf
ag -g "" | fzf rg --files | fzf
# Setting ag as the default source for fzf # Setting rg as the default source for fzf
export FZF_DEFAULT_COMMAND='ag -g ""' export FZF_DEFAULT_COMMAND='rg --files'
# Now fzf (w/o pipe) will use ag instead of find # Now fzf (w/o pipe) will use rg instead of find
fzf fzf
# To apply the command to CTRL-T as well # To apply the command to CTRL-T as well
@ -512,7 +512,7 @@ export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
If you don't want to exclude hidden files, use the following command: If you don't want to exclude hidden files, use the following command:
```sh ```sh
export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -g ""' export FZF_DEFAULT_COMMAND='rg --files --hidden --glob \!.git'
``` ```
#### `git ls-tree` for fast traversal #### `git ls-tree` for fast traversal