Skip to content
Myr

Handle dynamically loaded completion functions (#107 / #79)

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

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

  • other:+21 added−14 removed

1 file+21 added−14 removed

modified:fzf-completion.bash+21 added-14 removed
51 unmodified lines
5253 return 054}5556_fzf_handle_dynamic_completion() {57 local cmd orig ret58 cmd="$1"59 shift6061 orig=$(eval "echo \$_fzf_orig_completion_$cmd")62 if [ -n "$orig" ] && type "$orig" > /dev/null 2>&1; then63 $orig "$@"64 elif [ -n "$_fzf_completion_loader" ]; then65 _completion_loader "$@"66 ret=$?67 eval $(complete | \grep "\-F.* $cmd$" | _fzf_orig_completion_filter)68 source $BASH_SOURCE69 return $ret70 fi71}7273_fzf_path_completion() {57 local cur base dir leftover matches trigger cmd orig74 local cur base dir leftover matches trigger cmd75 cmd=$(echo ${COMP_WORDS[0]} | sed 's/[^a-z0-9_=]/_/g')76 COMPREPLY=()77 trigger=${FZF_COMPLETION_TRIGGER:-**}78 cur="${COMP_WORDS[COMP_CWORD]}"
25 unmodified lines
104 done105 else106 shift107 shift91 orig=$(eval "echo \$_fzf_orig_completion_$cmd")92 [ -n "$orig" ] && type "$orig" > /dev/null 2>&1 && $orig "$@"108 _fzf_handle_dynamic_completion "$cmd" "$@"109 fi110}111112_fzf_list_completion() {97 local cur selected trigger cmd src ret113 local cur selected trigger cmd src114 read -r src115 cmd=$(echo ${COMP_WORDS[0]} | sed 's/[^a-z0-9_=]/_/g')116 trigger=${FZF_COMPLETION_TRIGGER:-**}117 cur="${COMP_WORDS[COMP_CWORD]}"
10 unmodified lines
128 return 0129 fi130 else131 shift116 orig=$(eval "echo \$_fzf_orig_completion_$cmd")117 if [ -n "$orig" ] && type "$orig" > /dev/null; then118 $orig "$@"119 elif [ -n "$_fzf_completion_loader" ]; then120 _completion_loader "$@"121 ret=$?122 eval $(complete | \grep "\-F.* $cmd$" | _fzf_orig_completion_filter)123 source $BASH_SOURCE124 return $ret125 fi132 _fzf_handle_dynamic_completion "$cmd" "$@"133 fi134}135136_fzf_all_completion() {
111 unmodified lines