summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHeinrich Kruger <heindsight@gmail.com>2018-05-03 20:25:15 +0100
committerJunegunn Choi <junegunn.c@gmail.com>2018-05-04 04:25:15 +0900
commitddd2a109e4746160d1b88a438e3ea8bfa1c78e48 (patch)
treed996c5ccac67c5b75b58f93bea3a8d21e1f6de6f /bin
parent87504a528ee9ba8b26cbc0f496494f4418e848b9 (diff)
[fzf-tmux] Restore tmux window options (#1272)
Restore the original values of 'remain-on-exit' and 'synchronize-panes' options when exiting 'fzf-tmux'.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fzf-tmux7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/fzf-tmux b/bin/fzf-tmux
index 79407e60..1dc2a04a 100755
--- a/bin/fzf-tmux
+++ b/bin/fzf-tmux
@@ -136,6 +136,11 @@ fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id"
cleanup() {
\rm -f $argsf $fifo1 $fifo2 $fifo3
+ # Restore tmux window options
+ if [[ "${#tmux_win_opts[@]}" -gt 0 ]]; then
+ eval "tmux ${tmux_win_opts[@]}"
+ fi
+
# Remove temp window if we were zoomed
if [[ -n "$zoomed" ]]; then
tmux display-message -p "#{window_id}" > /dev/null
@@ -174,6 +179,8 @@ pppid=$$
echo -n "trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM;" > $argsf
close="; trap - EXIT SIGINT SIGTERM $close"
+tmux_win_opts=( $(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed 's/^/set-window-option /; s/$/ \\;/') )
+
if [[ -n "$term" ]] || [[ -t 0 ]]; then
cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" >> $argsf
TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\