Skip to content
Myr

Update README to add an example of _fzf_compgen_dir

Before adoption: this commit came in with the history the project adopted, so no landing records it.

/cc @chrisjohnson Close #1067 Close #1083

authored by Junegunn Choi · committed by Junegunn Choi · parent c4185e8 · Browse files · 1 file+14 added−3 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+14 added−3 removed

  • other:+14 added−3 removed

1 file+14 added−3 removed

modified:README.md+14 added-3 removed
365 unmodified lines
366367# Options to fzf command368export FZF_COMPLETION_OPTS='+c -x'369370# Use ag instead of the default find command for listing candidates.370# Use ag instead of the default find command for listing path candidates.371# - The first argument to the function is the base path to start traversal372# - Note that ag only lists files not directories372# - See the source code (completion.{bash,zsh}) for the details.373# - ag only lists files, so we use with-dir script to augment the output374_fzf_compgen_path() {375 ag -g "" "$1"375 ag -g "" "$1" | with-dir "$1"376}377378# Use ag to generate the list for directory completion379_fzf_compgen_dir() {380 ag -g "" "$1" | only-dir "$1"381}382```383384`only-dir` and `with-dir` scripts can be found [here][dir-scripts]. They are385written in Ruby, but you should be able to rewrite them in any language you386prefer.387388[dir-scripts]: https://gist.github.com/junegunn/8c3796a965f22e6a803fe53096ad7a75389390#### Supported commands391392On bash, fuzzy completion is enabled only for a predefined set of commands393(`complete | grep _fzf` to see the list). But you can enable it for other
176 unmodified lines