-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegral.zsh-theme
63 lines (58 loc) · 1.45 KB
/
integral.zsh-theme
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
integral() {
local version='0.2.2'
case $1 in
--version)
print "v$version"
;;
-h|--help)
cat <<EOF
integral [ group ... ] <function> [ args ... ]
$(print -l ${(ok)functions} | awk '/^integral:/' | sed s/integral:// | sed 's/:/ /')
EOF
;;
*)
integral:$1 $@[2,-1]
;;
esac
}
integral:init() {
# https://github.com/spaceship-prompt/spaceship-prompt/commit/111c6f160c4376001d5469f8e8771ee89ea4158a
local int_path=${${(%):-%x}:A:h}
export core_plugins=(
"$int_path/lib/config.zsh"
"$int_path/lib/helpers.zsh"
"$int_path/lib/module.zsh"
"$int_path/lib/zle.zsh"
)
for f in $core_plugins; do
if [[ -f $f ]]; then
source $f
else
print "Core plugin not found! Missing file: $f"
return 1
fi
done
if [[ $int_plugins ]]; then
for f in $int_plugins; do
source $f
done
fi
[[ -e $int_path/comp ]] && fpath+="$int_path/comp"
autoload -Uz add-zsh-hook
autoload -Uz add-zle-hook-widget
export VI_KEYMAP=${VI_KEYMAP:-"INSERT"}
export HOSTNAME=${HOSTNAME:-"$(hostname)"}
# === INIT ===
TRAPWINCH() {
integral render
zle && zle reset-prompt
}
add-zsh-hook precmd error_hook
add-zsh-hook precmd integral:render
add-zsh-hook precmd integral:helpers:cursor-shape
zle -N integral:line-pre-redraw
add-zle-hook-widget zle-line-pre-redraw integral:line-pre-redraw
integral render
zle -N zle-line-init integral:zle-line-init
}
integral init