Use absolute path of fzf when splitting tmux window

This commit is contained in:
Junegunn Choi 2015-03-07 09:29:16 +09:00
parent c111af0ed2
commit f7b52d2541

View File

@ -50,13 +50,19 @@ cleanup() {
} }
trap cleanup EXIT SIGINT SIGTERM trap cleanup EXIT SIGINT SIGTERM
fail() {
>&2 echo "$1"
exit 1
}
fzf=$(which fzf 2> /dev/null) || fail "fzf executable not found"
mkfifo $fifo2 mkfifo $fifo2
mkfifo $fifo3 mkfifo $fifo3
if [ -t 0 ]; then if [ -t 0 ]; then
tmux split-window $opt 'bash -c "fzf '"$fzf_args"' > '$fifo2'; echo \$? > '$fifo3'"' tmux split-window $opt 'sh -c "'$fzf' '"$fzf_args"' > '$fifo2'; echo \$? > '$fifo3'"'
else else
mkfifo $fifo1 mkfifo $fifo1
tmux split-window $opt 'bash -c "fzf '"$fzf_args"' < '$fifo1' > '$fifo2'; echo \$? > '$fifo3'"' tmux split-window $opt 'sh -c "'$fzf' '"$fzf_args"' < '$fifo1' > '$fifo2'; echo \$? > '$fifo3'"'
cat <&0 > $fifo1 & cat <&0 > $fifo1 &
fi fi
cat $fifo2 cat $fifo2