Skip to content

Instantly share code, notes, and snippets.

@kunev
Last active August 29, 2015 14:03
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 kunev/79c58d7066d16a916ef7 to your computer and use it in GitHub Desktop.
Save kunev/79c58d7066d16a916ef7 to your computer and use it in GitHub Desktop.
tmux attach with percol
function pattach() {
if [[ $1 == "" ]]; then
PERCOL=percol
else
PERCOL="precol --query $1"
fi
sessions=$(tmux ls)
[ $? -ne 0 ] && return
session=$(echo $sessions | eval $PERCOL | cut -d : -f 1)
if [[ -n "$session" ]]; then
tmux att -t $session
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment