aboutsummaryrefslogtreecommitdiffstats
path: root/_zsh/80-tmux.zsh
blob: ae0f1c56a883b6d627a6c451367bf9ec29503d13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#
# zsh/tmux.zsh
#


# Integrate `tmux` attach with `percol`
# Credit: https://github.com/mooz/percol
if exists percol; then
    function tmattach() {
        if [[ $1 == "" ]]; then
            PERCOL=percol
        else
            PERCOL="percol --query $1"
        fi

        sessions=$(tmux list-sessions)
        [ $? -ne 0 ] && return

        session=$(echo ${sessions} | eval ${PERCOL} | cut -d: -f1)
        if [[ -n "${session}" ]]; then
            tmux attach -t ${session}
        fi
    }
fi


alias ta='tmux attach -t'
alias tl='tmux list-sessions'
alias ts='tmux new-session -s'
alias tkss='tmux kill-session -t'
alias tksv='tmux kill-server'


# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: #