-
Notifications
You must be signed in to change notification settings - Fork 6
/
tmux.plugin.zsh
executable file
·50 lines (39 loc) · 1.18 KB
/
tmux.plugin.zsh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env zsh
# Standarized $0 handling, following:
# https://z-shell.github.io/zsh-plugin-assessor/Zsh-Plugin-Standard
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
DEPENDENCES_ARCH+=( tmux )
DEPENDENCES_DEBIAN+=( tmux )
if (( $+functions[zpm] )); then
zpm load zpm-zsh/colors zpm-zsh/helpers
fi
if [[ $PMSPEC != *f* ]] {
fpath+=( "${0:h}/functions" )
}
autoload -Uz tmux-motd
if [[ $PMSPEC != *b* ]] {
PATH=$PATH:"${0:h}/bin"
}
if (( $+commands[tmux] )); then
TMUX_AUTOSTART=${TMUX_AUTOSTART:-'true'}
TMUX_OVERRIDE_TERM=${TMUX_OVERRIDE_TERM:-'true'}
if [[ "$TMUX_AUTOSTART" == 'true' && -z "$TMUX" ]]; then
function _tmux_autostart() {
if [[ "$TMUX_OVERRIDE_TERM" == 'true' ]]; then
TERM=xterm-256color tmux -2 new-session -A -s main
else
tmux -2 new-session -A -s main
fi
exit 0
}
autoload -Uz add-zsh-hook
add-zsh-hook precmd _tmux_autostart
fi
if [[ $TMUX_MOTD == true && ! -z $TMUX ]]; then
declare -a list_windows; list_windows=( ${(f)"$(command tmux list-windows)"} )
if [[ "${#list_windows}" == 1 && "${list_windows}" == *"1 panes"* ]]; then
tmux-motd
fi
fi
fi