diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2015-03-07 09:29:16 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-03-07 09:29:16 +0900 |
commit | f7b52d2541fba6f10a86d33399f38fc38efcbc2a (patch) | |
tree | d895f0a60f3654e30a5c762eb96cd3acd5f25587 /bin | |
parent | c111af0ed23731942ac8cbeb88c9f9e5d819628a (diff) |
Use absolute path of fzf when splitting tmux window
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fzf-tmux | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/fzf-tmux b/bin/fzf-tmux index 4db037c2..d945c154 100755 --- a/bin/fzf-tmux +++ b/bin/fzf-tmux @@ -50,13 +50,19 @@ cleanup() { } 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 $fifo3 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 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 & fi cat $fifo2 |