Created
June 8, 2018 05:51
-
-
Save zshihang/ecae746156620b44f7dcfc668ecf71c3 to your computer and use it in GitHub Desktop.
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
tm() { | |
[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session" | |
if [ $1 ]; then | |
tmux $change -t "$1" 2>/dev/null || (tmux new-session -d -s $1 && tmux $change -t "$1"); return | |
fi | |
session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --exit-0) && tmux $change -t "$session" || echo "No sessions found." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment