Last active
June 19, 2019 01:07
-
-
Save ivan/f18fa937d9cbb00d52179bb1e8ef0662 to your computer and use it in GitHub Desktop.
Interactively pick and attach to a tmux session based on its output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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