aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/tmux.bash
blob: f4b4208198a71f35b2f4d915e0ed4906bcf3981d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# Attach to existing tmux session rather than create a new one if possible
tmux() {

    # If sessions exist, default the arguments to the attach-session command
    if command tmux has-session 2>/dev/null; then
        command tmux "${@:-attach-session}"

    # Otherwise, just call tmux directly with the given arguments
    else
        command tmux "$@"
    fi
}