# zshmux
-A super simple zsh plugin to attach to tmux sessions for new shells
+
+If a new shell is launched, *zshmux* quickly checks if there are any tmux sessions, or if the current shell is already in a tmux instance.
+If you are not already in a tmux session *zshmux* will ask if you want to attach a currently running session, or make a new session in the shell.
+
+## How to use:
+-Clone this repository
+ 'git clone https://github.com/huboles/zshmux'
+-Source *zshmux* in your .zshrc
+ 'source <path-to-zshmux>/zshmux/zshmux.zsh'
--- /dev/null
+#!/bin/zsh
+
+if [[ -z $TMUX ]]; then
+ if tlist &> /dev/null ; then
+ printf 'Current tmux sessions:\n\n'
+ tlist
+ else
+ printf '\nNo tmux sessions active\n'
+ fi
+ printf '\n\tAttach session?: [name] (empty if none): '
+ read response
+ if [ -n "$response" ]; then
+ if tlist | grep -q "$response"; then
+ tmux attach-session -t $response
+ else
+ tmux new-session -s $response
+ fi
+ fi
+fi