Skip to content
Myr

[fzf-tmux] Close with exit code 130 when tmux pane is killed

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #796

authored by Kouki Higashikawa · committed by Junegunn Choi · parent 9078197 · Browse files · 1 file+11 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−3 removed

  • other:+11 added−3 removed

1 file+11 added−3 removed

modified:bin/fzf-tmux+11 added-3 removed
142 unmodified lines
143 select-window -t $original_window \; \144 kill-window -t $tmp_window \; \145 resize-pane -Z146 fi147148 if [ $# -gt 0 ]; then149 exit 130150 fi151}148trap cleanup EXIT SIGINT SIGTERM152trap 'cleanup 1' SIGUSR1153154envs="env TERM=$TERM "155[[ -n "$FZF_DEFAULT_OPTS" ]] && envs="$envs FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS")"156[[ -n "$FZF_DEFAULT_COMMAND" ]] && envs="$envs FZF_DEFAULT_COMMAND=$(printf %q "$FZF_DEFAULT_COMMAND")"
10 unmodified lines
167 arg="${arg//$/\\$}"168 opts="$opts \"$arg\""169done170171pppid=$$172trap_set="trap 'kill -SIGUSR1 $pppid' EXIT SIGINT SIGTERM"173trap_unset="trap - EXIT SIGINT SIGTERM"174175if [[ -n "$term" ]] || [[ -t 0 ]]; then176 cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" > $argsf177 TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\178 set-window-option remain-on-exit off \;\171 split-window $opt "cd $(printf %q "$PWD");$envs bash $argsf" $swap \179 split-window $opt "$trap_set;cd $(printf %q "$PWD");$envs bash $argsf;$trap_unset" $swap \180 > /dev/null 2>&1181else182 mkfifo $fifo1183 cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" > $argsf184 TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\185 set-window-option remain-on-exit off \;\178 split-window $opt "$envs bash $argsf" $swap \186 split-window $opt "$trap_set;$envs bash $argsf;$trap_unset" $swap \187 > /dev/null 2>&1188 cat <&0 > $fifo1 &189fi190cat $fifo2
2 unmodified lines