Skip to content

Instantly share code, notes, and snippets.

@ivan
Last active June 19, 2019 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan/f18fa937d9cbb00d52179bb1e8ef0662 to your computer and use it in GitHub Desktop.
Save ivan/f18fa937d9cbb00d52179bb1e8ef0662 to your computer and use it in GitHub Desktop.
Interactively pick and attach to a tmux session based on its output
rpick() {
session=$(for i in $(tmux list-sessions -F '#S'); do
echo -e -n "$i\t"; { { tmux capture-pane -p -t "$i" | tr '\n' ' ' } || true }
echo
done | fzf --exact --reverse | cut -f 1)
if [[ "$session" != "" ]]; then
tmux attach -t "$session"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment