diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2024-05-07 19:31:13 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2024-05-07 19:31:56 +0900 |
| commit | cd8d736a9f4074de3aafdf3c10fff75cfb6c5ed0 (patch) | |
| tree | 84d100943e2dab49b7a33f007cb5e54efd6b49d2 /shell/completion.bash | |
| parent | 0952b2dfd48e72fa82430e4d58a923f594e43c69 (diff) | |
| download | fzf-cd8d736a9f4074de3aafdf3c10fff75cfb6c5ed0.tar.gz | |
[shell] Add $FZF_COMPLETION_{DIR,PATH}_OPTS
To allow separately overriding 'walker' options.
Close #3778
Diffstat (limited to 'shell/completion.bash')
| -rw-r--r-- | shell/completion.bash | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/shell/completion.bash b/shell/completion.bash index 43fa46af..e01b3005 100644 --- a/shell/completion.bash +++ b/shell/completion.bash @@ -4,10 +4,12 @@ # / __/ / /_/ __/ # /_/ /___/_/ completion.bash # -# - $FZF_TMUX (default: 0) -# - $FZF_TMUX_OPTS (default: empty) -# - $FZF_COMPLETION_TRIGGER (default: '**') -# - $FZF_COMPLETION_OPTS (default: empty) +# - $FZF_TMUX (default: 0) +# - $FZF_TMUX_OPTS (default: empty) +# - $FZF_COMPLETION_TRIGGER (default: '**') +# - $FZF_COMPLETION_OPTS (default: empty) +# - $FZF_COMPLETION_PATH_OPTS (default: empty) +# - $FZF_COMPLETION_DIR_OPTS (default: empty) if [[ $- =~ i ]]; then @@ -297,8 +299,14 @@ __fzf_generic_path_completion() { if declare -F "$1" > /dev/null; then eval "$1 $(printf %q "$dir")" | __fzf_comprun "$4" -q "$leftover" else - [[ $1 =~ dir ]] && walker=dir,follow || walker=file,dir,follow,hidden - __fzf_comprun "$4" -q "$leftover" --walker "$walker" --walker-root="$dir" + if [[ $1 =~ dir ]]; then + walker=dir,follow + rest=${FZF_COMPLETION_DIR_OPTS-} + else + walker=file,dir,follow,hidden + rest=${FZF_COMPLETION_PATH_OPTS-} + fi + __fzf_comprun "$4" -q "$leftover" --walker "$walker" --walker-root="$dir" $rest fi | while read -r item; do printf "%q " "${item%$3}$3" done |
