Update README: Examples using fd
Before adoption: this commit came in with the history the project adopted, so no landing records it.
- https://github.com/sharkdp/fd - https://mike.place/2017/fzf-fd/ /cc @williamsmj
authored by Junegunn Choi · committed by Junegunn Choi · parent fe7b91d · Browse files · 1 file·+20 added−23 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+20 added−23 removed
- other:+20 added−23 removed
Provenance
- Commit
a6d2ab3- Tree
6248c16- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
fe7b91d
1 file changed+20 added−23 removed
modified:README.md+20 added-23 removed
229 unmodified lines230 #### Environment variables231 232 - `FZF_DEFAULT_COMMAND`233 - Default command to use when input is tty234- - e.g. `export FZF_DEFAULT_COMMAND='rg --files'`234+ - e.g. `export FZF_DEFAULT_COMMAND='fd --type f'`235 - `FZF_DEFAULT_OPTS`236 - Default options237 - e.g. `export FZF_DEFAULT_OPTS="--reverse --inline-info"`238 129 unmodified lines368 369 # Options to fzf command370 export FZF_COMPLETION_OPTS='+c -x'371 372-# Use rg (https://github.com/BurntSushi/ripgrep) instead of the default find372+# Use fd (https://github.com/sharkdp/fd) instead of the default find373 # command for listing path candidates.374-# - The first argument to the function is the base path to start traversal374+# - The first argument to the function ($1) is the base path to start traversal375 # - See the source code (completion.{bash,zsh}) for the details.376-# - rg only lists files, so we use with-dir script to augment the output376 _fzf_compgen_path() {378- rg --files "$1" | with-dir "$1"377+ fd --hidden --follow --exclude ".git" . "$1"378 }379 381-# Use rg to generate the list for directory completion380+# Use fd to generate the list for directory completion381 _fzf_compgen_dir() {383- rg --files "$1" | only-dir "$1"382+ fd --type d --hidden --follow --exclude ".git" . "$1"383 }384 ```385 387-`only-dir` and `with-dir` scripts can be found [here][dir-scripts]. They are388-written in Ruby, but you should be able to rewrite them in any language you389-prefer.390-391-[dir-scripts]: https://gist.github.com/junegunn/8c3796a965f22e6a803fe53096ad7a75392-386 #### Supported commands387 388 On bash, fuzzy completion is enabled only for a predefined set of commands389 (`complete | grep _fzf` to see the list). But you can enable it for other92 unmodified lines482 483 Tips484 ----485 493-#### Respecting `.gitignore`, `.hgignore`, and `svn:ignore`486+#### Respecting `.gitignore`487 488+You can use [fd](https://github.com/sharkdp/fd),495-[ripgrep](https://github.com/BurntSushi/ripgrep) or [the silver496-searcher](https://github.com/ggreer/the_silver_searcher) can do the filtering:489+[ripgrep](https://github.com/BurntSushi/ripgrep), or [the silver490+searcher](https://github.com/ggreer/the_silver_searcher) instead of the491+default find command to traverse the file system while respecting492+`.gitignore`.493 494 ```sh499-# Feed the output of rg into fzf500-rg --files | fzf495+# Feed the output of fd into fzf496+fd --type f | fzf497 502-# Setting rg as the default source for fzf503-export FZF_DEFAULT_COMMAND='rg --files'498+# Setting fd as the default source for fzf499+export FZF_DEFAULT_COMMAND='fd --type f'500 505-# Now fzf (w/o pipe) will use rg instead of find501+# Now fzf (w/o pipe) will use fd instead of find502 fzf503 504 # To apply the command to CTRL-T as well505 export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"506 ```507 508+If you want the command to follow symbolic links, and don't want it to exclude512-If you don't want to exclude hidden files, use the following command:509+hidden files, use the following command:510 511 ```sh515-export FZF_DEFAULT_COMMAND='rg --files --hidden --glob \!.git'512+export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'513 ```514 515 #### `git ls-tree` for fast traversal516 52 unmodified lines