summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-02-16 12:32:05 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-02-16 12:32:05 +0900
commita568120e42a86bc37b87ae6facab91f7b35f988e (patch)
tree30f9d8e3df8288d1d17e5e67274f38cc3c2d5cbc /shell
parente57182c6580d887c85cf0ec0f9d0032671dd585a (diff)
Fix #494 - _fzf_complete hangs on zsh when not using tmux pane
Diffstat (limited to 'shell')
-rw-r--r--shell/completion.zsh13
1 files changed, 11 insertions, 2 deletions
diff --git a/shell/completion.zsh b/shell/completion.zsh
index a1e1e079..8288cb27 100644
--- a/shell/completion.zsh
+++ b/shell/completion.zsh
@@ -79,8 +79,15 @@ _fzf_dir_completion() {
"" "/" ""
}
+_fzf_feed_fifo() (
+ rm -f "$fifo"
+ mkfifo "$fifo"
+ cat <&0 > "$fifo" &
+)
+
_fzf_complete() {
- local fzf_opts lbuf fzf matches post
+ local fifo fzf_opts lbuf fzf matches post
+ fifo="${TMPDIR:-/tmp}/fzf-complete-fifo-$$"
fzf_opts=$1
lbuf=$2
post="${funcstack[2]}_post"
@@ -88,11 +95,13 @@ _fzf_complete() {
[ ${FZF_TMUX:-1} -eq 1 ] && fzf="fzf-tmux -d ${FZF_TMUX_HEIGHT:-40%}" || fzf="fzf"
- matches=$(cat | ${=fzf} ${=FZF_COMPLETION_OPTS} ${=fzf_opts} -q "${(Q)prefix}" | $post | tr '\n' ' ')
+ _fzf_feed_fifo "$fifo"
+ matches=$(cat "$fifo" | ${=fzf} ${=FZF_COMPLETION_OPTS} ${=fzf_opts} -q "${(Q)prefix}" | $post | tr '\n' ' ')
if [ -n "$matches" ]; then
LBUFFER="$lbuf$matches"
fi
zle redisplay
+ rm -f "$fifo"
}
_fzf_complete_telnet() {