blob: 8a7a4587e708edca43ba23d4293af2da0f218049 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/bin/sh
if [ "$#" -eq 0 ]; then
FZF_CMD="sshr -tE -L default"
# shellcheck disable=2016,2046
set -- $(
$FZF_CMD |
fzf-tmux "$FZF_TMUX_OPTS" -- --tac --select-1 --exit-0 \
--bind "ctrl-q:execute(tmux kill-session -t{})+reload($FZF_CMD)" \
--preview-window=right,80% --preview='tmux capture-pane -ep -t{}:'
)
fi
if [ "$#" -eq 0 ]; then
exit 0
fi
if [ -z "$TMUX" ]; then
tmux attach-session -t "$1"
else
tmux switch-client -t "$1"
fi
|