From 96176476f3990507b38f2ec45d24c12fcb7aa075 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 20 Jan 2016 01:09:58 +0900 Subject: Make fuzzy completion customizable with _fzf_compgen_{path,dir} Notes: - You can now override _fzf_compgen_path and _fzf_compgen_dir functions to use custom commands such as ag instead of find for listing completion candidates. - The first argument is the base path to start traversal - Removed file-only completion in bash, i.e. _fzf_file_completion. Maintaining a list of commands that only expect files, not directories, is cumbersome (there are too many) and error-prone. TBD: - Added $FZF_COMPLETION_DIR_COMMANDS to customize the list of commands which use directory-only completion. The default is "cd pushd rmdir". Not sure if it's the best approach to address the requirement, I'll leave it as an undocumented feature. Related: #406 (@thomcom), #456 (@frizinak) --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 567271c5..5e3a1f04 100644 --- a/README.md +++ b/README.md @@ -259,6 +259,14 @@ export FZF_COMPLETION_TRIGGER='~~' # Options to fzf command export FZF_COMPLETION_OPTS='+c -x' + +# Use ag instead of the default find command for listing candidates. +# - The first argument to the function is the base path to start traversal +# - Note that ag only lists files not directories +# - See the source code (completion.{bash,zsh}) for the details. +_fzf_compgen_paths() { + ag -g "" "$1" +} ``` #### Supported commands -- cgit v1.2.3