blob: 9a4ad9cc85e5fe3db7a42ed96d4b9d1524d4eb2e (
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
35
36
37
|
#
# 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
# Handy aliases
if exists tmattach; then
alias tma=tmattach
else
alias tma='tmux attach -t'
fi
alias tml='tmux list-sessions'
alias tms='tmux new-session -s'
# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: #
|