-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
77 lines (63 loc) · 2.08 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
unset zle_bracketed_paste
#
update-dotfiles() {
local dotter_bin
if [ -n "$DOTTER_BIN" ]; then
if [ ! -x "$DOTTER_BIN" ]; then
echo '[DOTFILES] `DOTTER_BIN` is not executable, check your dotter installation'
return 1
fi
dotter_bin=$DOTTER_BIN
elif [ -x "$(command -v dotter)" ] ; then
dotter_bin=dotter
else
echo '[DOTFILES] dotter not in your PATH, you can use env `DOTTER_BIN` to specify it'
return 1
fi
local root=${DOTFILES_ROOT:-~/.dotfiles}
local local_toml=${DOTFILES_LOCAL:-$root/.dotter/local.toml}
if [ -d "$root" ]; then
if [ ! -f "$local_toml" ]; then
echo '[DOTFILES] local.toml not found, you can use env `DOTFILES_LOCAL` to specify one'
return 1
fi
(
cd "$root" \
&& (if [ -z "$DOTFILES_IGNORE_REMOTE" ]; then _cur=$(git rev-parse --short=7 HEAD) \
&& git pull --recurse-submodules \
&& git submodule update --init \
&& git --no-pager log --oneline --reverse $_cur..HEAD ; fi) \
&& (if [ "$1" = "-f" ]; then $dotter_bin -vf -l "$local_toml" ; else $dotter_bin -v -l "$local_toml"; fi )
)
else
echo '[DOTFILES] root if dotfiles not found, you can use env `DOTFILES_ROOT` to specify it'
return 1
fi
echo '[DOTFILES] done.'
}
#
_source_configs() {
local root="$1"
local config
for config in "$root"/**/*.zsh(N-.); do
. "$config"
done
}
_zsh_cfgdir="$HOME/.zsh"
_source_configs "$_zsh_cfgdir/configs"
if [ -d "$_zsh_cfgdir/plugins" ]; then
. "$_zsh_cfgdir/plugins/zinit.zsh"
. "$_zsh_cfgdir/plugins/plugins.zsh"
_source_configs "$_zsh_cfgdir/plugins/configs"
fi
_source_configs "$_zsh_cfgdir/after"
unset _source_configs _zsh_cfgdir
#
[ "$TERM" = "xterm" ] && export TERM="xterm-256color"
export PATH=$HOME/.scripts:$PATH
[ -f ~/.zshrc.local ] && . ~/.zshrc.local
[ -f ~/.aliases ] && . ~/.aliases
[ -f ~/.env.sh ] && . ~/.env.sh
#
autoload -U +X bashcompinit && bashcompinit
autoload -U +X compinit && compinit