darkrc/bin/tmux-fzf

14 lines
279 B
Text
Raw Permalink Normal View History

2024-10-21 08:56:49 +00:00
#!/bin/sh
case $1 in
ssh) ssh_host=$2
esac
if [ -n "$ssh_host" ]
then
target="$(ssh $ssh_host tmux ls | cut -d : -f 1 | fzf)"
[ -n "$target" ] && ssh $ssh_host -t tmux a -t "$target"
else
target="$(tmux ls | cut -d : -f 1 | fzf)"
[ -n "$target" ] && tmux a -t "$target"
fi