Skip to content
Myr

[shell] Add $FZF_COMPLETION_{DIR,PATH}_OPTS

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

To allow separately overriding 'walker' options. Close #3778

authored by Junegunn Choi · committed by Junegunn Choi · parent 0952b2d · Browse files · 2 files+28 added−12 removed
This commit

State

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

Diff stats

2 files+28 added−12 removed

  • other:+28 added−12 removed

2 files+28 added−12 removed

modified:shell/completion.bash+14 added-6 removed
2 unmodified lines
3# / /_/_ / / /_4# / __/ / /_/ __/5# /_/ /___/_/ completion.bash6#7# - $FZF_TMUX (default: 0)8# - $FZF_TMUX_OPTS (default: empty)9# - $FZF_COMPLETION_TRIGGER (default: '**')10# - $FZF_COMPLETION_OPTS (default: empty)7# - $FZF_TMUX (default: 0)8# - $FZF_TMUX_OPTS (default: empty)9# - $FZF_COMPLETION_TRIGGER (default: '**')10# - $FZF_COMPLETION_OPTS (default: empty)11# - $FZF_COMPLETION_PATH_OPTS (default: empty)12# - $FZF_COMPLETION_DIR_OPTS (default: empty)1314if [[ $- =~ i ]]; then1516
281 unmodified lines
298 unset FZF_DEFAULT_COMMAND FZF_DEFAULT_OPTS_FILE299 if declare -F "$1" > /dev/null; then300 eval "$1 $(printf %q "$dir")" | __fzf_comprun "$4" -q "$leftover"301 else300 [[ $1 =~ dir ]] && walker=dir,follow || walker=file,dir,follow,hidden301 __fzf_comprun "$4" -q "$leftover" --walker "$walker" --walker-root="$dir"302 if [[ $1 =~ dir ]]; then303 walker=dir,follow304 rest=${FZF_COMPLETION_DIR_OPTS-}305 else306 walker=file,dir,follow,hidden307 rest=${FZF_COMPLETION_PATH_OPTS-}308 fi309 __fzf_comprun "$4" -q "$leftover" --walker "$walker" --walker-root="$dir" $rest310 fi | while read -r item; do311 printf "%q " "${item%$3}$3"312 done313 )
249 unmodified lines
modified:shell/completion.zsh+14 added-6 removed
2 unmodified lines
3# / /_/_ / / /_4# / __/ / /_/ __/5# /_/ /___/_/ completion.zsh6#7# - $FZF_TMUX (default: 0)8# - $FZF_TMUX_OPTS (default: '-d 40%')9# - $FZF_COMPLETION_TRIGGER (default: '**')10# - $FZF_COMPLETION_OPTS (default: empty)7# - $FZF_TMUX (default: 0)8# - $FZF_TMUX_OPTS (default: empty)9# - $FZF_COMPLETION_TRIGGER (default: '**')10# - $FZF_COMPLETION_OPTS (default: empty)11# - $FZF_COMPLETION_PATH_OPTS (default: empty)12# - $FZF_COMPLETION_DIR_OPTS (default: empty)131415# Both branches of the following `if` do the same thing -- define16# __fzf_completion_options such that `eval $__fzf_completion_options` sets
144 unmodified lines
161 unset FZF_DEFAULT_COMMAND FZF_DEFAULT_OPTS_FILE162 if declare -f "$compgen" > /dev/null; then163 eval "$compgen $(printf %q "$dir")" | __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover"164 else163 [[ $compgen =~ dir ]] && walker=dir,follow || walker=file,dir,follow,hidden164 __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" --walker "$walker" --walker-root="$dir" < /dev/tty165 if [[ $compgen =~ dir ]]; then166 walker=dir,follow167 rest=${FZF_COMPLETION_DIR_OPTS-}168 else169 walker=file,dir,follow,hidden170 rest=${FZF_COMPLETION_PATH_OPTS-}171 fi172 __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" --walker "$walker" --walker-root="$dir" ${(Q)${(Z+n+)rest}} < /dev/tty173 fi | while read item; do174 item="${item%$suffix}$suffix"175 echo -n "${(q)item} "176 done
198 unmodified lines