-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
97 lines (81 loc) · 1.62 KB
/
.zshrc
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
87
88
89
90
91
92
93
94
95
96
97
#!/hint/zsh
# Very first thing.
setopt extended_glob
function load_zshrc_d() {
local dir=$1 f
# load "completion" first because other snippets define completions
# load "colors" before completion because completion zstyles use $LS_COLORS
for f in \
$dir/colors*(-.N) \
$dir/completion*(-.N) \
$dir/(^completion*|colors*)(-.N) \
# EOL
do
source $f
done
}
function do_load_plugin() {
local dir=$1 name=${2-${1:t}} f
for f in $dir/$name.{plugin.zsh,zsh}(-.N); do
source $f
return 0
done
print >&2 "Cannot load plugin ${(qqq)name} from ${(qqq)dir}"
return 1
}
function load_plugin_d() {
local dir=$1 p
for p in $dir/*(-/N); do
do_load_plugin $p
done
}
function load_plugin() {
local name=$1 p
shift
for p in {~/.zsh/plugins,/usr/share/zsh/plugins}/$name(-/N); do
do_load_plugin $p $@
return
done
print >&2 "Cannot find plugin dir ${(qqq)name}"
return 1
}
#
# early snippets, before switching to tmux
#
load_zshrc_d $HOME/.zshrc.early.d
#
# tmux shortcut
#
[[ -z "$WSLENV"
&& -z "$NOTMUX"
&& -z "$TMUX"
&& -z "$SUDO_USER"
&& "$UID" == "$(stat -c "%u" "${(%):-%x}")"
&& "$TERMINAL_EMULATOR" != *JetBrains*
&& -z "$TERMINUS_SUBLIME"
&& -z "$JUPYTER_SERVER_URL"
&& -z "$VIM"
]] \
&& command -v tmx &>/dev/null \
&& exec tmx
#
# snippets (aliases, colors etc.)
#
load_zshrc_d ~/.zshrc.d
if [[ -e ~/.zshrc.private ]]; then
source ~/.zshrc.private
fi
#
# plugins
#
load_plugin fzf-tab # ordering: first thing to load after zshrc.d
load_plugin zsh-autosuggestions
load_plugin jq-zsh-plugin jq
#
# late snippets (prompt)
#
load_zshrc_d ~/.zshrc.late.d
#
# late plugins
#
load_plugin zsh-syntax-highlighting