Skip to content
Myr

[completion] Use file redirection instead of pipe

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

This change allows the completion system of bash and zsh to return before the input process completes. Related #1887

authored by Junegunn Choi · committed by Junegunn Choi · parent ba82f0b · Browse files · 2 files+2 added−2 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+2 added−2 removed

  • other:+2 added−2 removed

2 files+2 added−2 removed

modified:shell/completion.bash+1 added-1 removed
198 unmodified lines
199 cur="${COMP_WORDS[COMP_CWORD]}"200 if [[ "$cur" == *"$trigger" ]]; then201 cur=${cur:0:${#cur}-${#trigger}}202203 selected=$(cat | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS $1" __fzf_comprun "$2" -q "$cur" | $post | tr '\n' ' ')203 selected=$(FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS $1" __fzf_comprun "$2" -q "$cur" | $post | tr '\n' ' ')204 selected=${selected% } # Strip trailing space not to repeat "-o nospace"205 if [ -n "$selected" ]; then206 COMPREPLY=("$selected")207 else
138 unmodified lines
modified:shell/completion.zsh+1 added-1 removed
114 unmodified lines
115 post="${funcstack[2]}_post"116 type $post > /dev/null 2>&1 || post=cat117118 _fzf_feed_fifo "$fifo"119 matches=$(cat "$fifo" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "${(Q)prefix}" | $post | tr '\n' ' ')119 matches=$(FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS" __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "${(Q)prefix}" < "$fifo" | $post | tr '\n' ' ')120 if [ -n "$matches" ]; then121 LBUFFER="$lbuf$matches"122 fi123 zle reset-prompt
100 unmodified lines