File tree 2 files changed +9
-22
lines changed
2 files changed +9
-22
lines changed Original file line number Diff line number Diff line change @@ -156,15 +156,10 @@ __fzf_generic_path_completion() {
156
156
fi
157
157
}
158
158
159
- _fzf_feed_fifo () (
160
- rm -f " $fifo "
161
- mkfifo " $fifo "
162
- cat < & 0 > " $fifo " &
163
- )
164
-
165
159
_fzf_complete () {
166
- local fifo cur selected trigger cmd fzf
167
- fifo=" ${TMPDIR:-/ tmp} /fzf-complete-fifo-$$ "
160
+ local cur selected trigger cmd fzf post
161
+ post=" $( caller 0 | awk ' {print $2}' ) _post"
162
+ type -t $post > /dev/null 2>&1 || post=cat
168
163
[ ${FZF_TMUX:- 1} -eq 1 ] && fzf=" fzf-tmux -d ${FZF_TMUX_HEIGHT:- 40% } " || fzf=" fzf"
169
164
170
165
cmd=$( echo ${COMP_WORDS[0]} | sed ' s/[^a-z0-9_=]/_/g' )
@@ -173,12 +168,10 @@ _fzf_complete() {
173
168
if [[ ${cur} == * " $trigger " ]]; then
174
169
cur=${cur: 0: ${# cur} -${# trigger} }
175
170
176
- _fzf_feed_fifo " $fifo "
177
171
tput sc
178
- selected=$( eval " cat ' $fifo ' | $fzf $FZF_COMPLETION_OPTS $1 -q ' $cur ' " | tr ' \n' ' ' )
172
+ selected=$( cat | $fzf $FZF_COMPLETION_OPTS $1 -q " $cur " | $post | tr ' \n' ' ' )
179
173
selected=${selected% } # Strip trailing space not to repeat "-o nospace"
180
174
tput rc
181
- rm -f " $fifo "
182
175
183
176
if [ -n " $selected " ]; then
184
177
COMPREPLY=(" $selected " )
Original file line number Diff line number Diff line change @@ -79,26 +79,20 @@ _fzf_dir_completion() {
79
79
" " " /" " "
80
80
}
81
81
82
- _fzf_feed_fifo () (
83
- rm -f " $fifo "
84
- mkfifo " $fifo "
85
- cat < & 0 > " $fifo " &
86
- )
87
-
88
82
_fzf_complete () {
89
- local fifo fzf_opts lbuf fzf matches
90
- fifo=" ${TMPDIR:-/ tmp} /fzf-complete-fifo-$$ "
83
+ local fzf_opts lbuf fzf matches post
91
84
fzf_opts=$1
92
85
lbuf=$2
86
+ post=" ${funcstack[2]} _post"
87
+ type $post > /dev/null 2>&1 || post=cat
88
+
93
89
[ ${FZF_TMUX:- 1} -eq 1 ] && fzf=" fzf-tmux -d ${FZF_TMUX_HEIGHT:- 40% } " || fzf=" fzf"
94
90
95
- _fzf_feed_fifo " $fifo "
96
- matches=$( cat " $fifo " | ${=fzf} ${=FZF_COMPLETION_OPTS} ${=fzf_opts} -q " ${(Q)prefix} " | tr ' \n' ' ' )
91
+ matches=$( cat | ${=fzf} ${=FZF_COMPLETION_OPTS} ${=fzf_opts} -q " ${(Q)prefix} " | $post | tr ' \n' ' ' )
97
92
if [ -n " $matches " ]; then
98
93
LBUFFER=" $lbuf$matches "
99
94
fi
100
95
zle redisplay
101
- rm -f " $fifo "
102
96
}
103
97
104
98
_fzf_complete_telnet () {
You can’t perform that action at this time.
0 commit comments