Skip to content

Instantly share code, notes, and snippets.

@kunev
Created July 17, 2016 11:27
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/dccfd344802c3b602c4936aa2abf576c to your computer and use it in GitHub Desktop.
Save kunev/dccfd344802c3b602c4936aa2abf576c to your computer and use it in GitHub Desktop.
fzf menu to start/attach a tmux session
if [[ -z $TMUX ]]; then
new_session_token='START NEW SESSION'
no_session='DO NOT START TMUX'
choice=$( (echo $new_session_token; echo $no_session; tmux ls) | fzf | cut -d':' -f 1)
case "$choice" in
"$new_session_token")
tmux new-session
exit
;;
"$no_session")
;;
*)
tmux att -t $choice
exit
;;
esac
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment