summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fzf-tmux12
1 files changed, 9 insertions, 3 deletions
diff --git a/bin/fzf-tmux b/bin/fzf-tmux
index ed255fc9..17d6c874 100755
--- a/bin/fzf-tmux
+++ b/bin/fzf-tmux
@@ -151,7 +151,13 @@ argsf="${TMPDIR:-/tmp}/fzf-args-$id"
fifo1="${TMPDIR:-/tmp}/fzf-fifo1-$id"
fifo2="${TMPDIR:-/tmp}/fzf-fifo2-$id"
fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id"
-tmux_win_opts=( $(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed '/ off/d; s/^/set-window-option /; s/$/ \\;/') )
+if tmux_win_opts=$(tmux show-options -p remain-on-exit \; show-options -p synchronize-panes 2> /dev/null); then
+ tmux_win_opts=( $(sed '/ off/d; s/synchronize-panes/set-option -p synchronize-panes/; s/remain-on-exit/set-option -p remain-on-exit/; s/$/ \\;/' <<< "$tmux_win_opts") )
+ tmux_off_opts='; set-option -p synchronize-panes off ; set-option -p remain-on-exit off'
+else
+ tmux_win_opts=( $(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed '/ off/d; s/^/set-window-option /; s/$/ \\;/') )
+ tmux_off_opts='; set-window-option synchronize-panes off ; set-window-option remain-on-exit off'
+fi
cleanup() {
\rm -f $argsf $fifo1 $fifo2 $fifo3
@@ -227,9 +233,9 @@ else
cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" >> $argsf
cat <&0 > $fifo1 &
fi
-tmux set-window-option synchronize-panes off \;\
- set-window-option remain-on-exit off \;\
+tmux \
split-window -c "$PWD" $opt "bash -c 'exec -a fzf bash $argsf'" $swap \
+ $tmux_off_opts \
> /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; }
cat $fifo2
exit "$(cat $fifo3)"