blob: a6b3c4863797f141407d5721caf9141917c9fd96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/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)" \
--bind 'focus:transform-header(tmux display -t{} -p "#{session_path}")' \
--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
|