-
Notifications
You must be signed in to change notification settings - Fork 2
/
helpers.plugin.zsh
86 lines (72 loc) · 1.47 KB
/
helpers.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env zsh
# Standarized ZSH polyfills, following:
# https://z-shell.github.io/zsh-plugin-assessor/Zsh-Plugin-Standard
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
if [[ $PMSPEC != *f* ]] {
fpath+=( "${0:h}/functions" )
}
autoload -Uz \
path fpath p \
appendpath prependpath \
appendfpath prependfpath \
appendmanpath prependmanpath \
appendinfopath prependinfopath \
is-recursive-exist \
debug \
is-callable is-true \
hyperlink hyperlink-pr \
hyperlink-file hyperlink-file-pr
typeset -Ag is
if [[ "${OSTYPE}" == "linux-gnu" ]]; then
is[linux]=1
else
is[linux]=0
fi
if [[ "${OSTYPE}" == *"bsd"* ]]; then
is[bsd]=1
else
is[bsd]=0
fi
if [[ "${OSTYPE}" == "darwin"* ]]; then
is[darwin]=1
is[macos]=1
else
is[darwin]=0
is[macos]=0
fi
if [[ "${TERM_PROGRAM}" == "iTerm.app" ]]; then
is[iterm]=1
else
is[iterm]=0
fi
if [[ "${OSTYPE}" == "linux-android"* ]]; then
is[android]=1
else
is[android]=0
fi
if [[ -n "$SSH_CONNECTION" ]]; then
is[ssh]=1
else
is[ssh]=0
fi
if [[ "${VTE_VERSION:-0}" -ge 3405 ]]; then
is[vte]=1
else
is[vte]=0
fi
if [[ "${+commands[opkg]}" == "1" ]]; then
is[openwrt]=1
else
is[openwrt]=0
fi
if [[ "${OSTYPE}" == "msys" ]]; then
is[msys]=1
else
is[msys]=0
fi
if [[ "${TERM_PROGRAM}" == "vscode" ]]; then
is[vscode]=1
else
is[vscode]=0
fi