A Fish Shell function to select and enter tmux sessions
tmux
fish
This fish shell function gets the name of current tmux sessions and pipes the session names into the fzf prompt. The user is attached to the the tmux
session selected in fzf
.
function tma
set sessions (tmux ls -F '#{session_name}')
set session (printf %s\n $sessions | fzf --prompt=" Tmux session " --height=50% --layout=reverse --border --exit-0)
if set -q TMUX
set tmux_cmd switchc
echo "In a tmux session: $TMUX"
else
set tmux_cmd attach
echo "Not in a TMUX session"
end
tmux $tmux_cmd -t $session
end