-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.zsh
More file actions
46 lines (38 loc) · 1.24 KB
/
Copy pathmain.zsh
File metadata and controls
46 lines (38 loc) · 1.24 KB
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
#!/usr/bin/env zsh
# ref: https://github.com/zdharma-continuum/fast-syntax-highlighting/blob/master/fast-syntax-highlighting.plugin.zsh#L37
# Standarized way of handling finding plugin dir,
# regardless of functionargzero and posixargzero,
# and with an option for a plugin manager to alter
# the plugin directory (i.e. set ZERO parameter)
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
if [[ -n ${RAINB_SCRIPTS_LOADED:-} ]]; then
return 0 2>/dev/null || exit 0
fi
typeset -g RAINB_SCRIPTS_LOADED=1
FONT='\033[0m'
GREEN="\033[1;32m"
RED='\033[1;31m'
YELLOW='\033[1;33m'
BLUE='\033[1;36m'
source "${0:h}"/config/rc.zsh
# add folder in functions to fpath
fpath=(
# / for directory, N for empty folder to empty string
"${0:h}"/functions/**/*(N/)
"${0:h}"/completions
$fpath
)
if ! (( $+functions[compdef] )); then
autoload -Uz compinit
compinit -C -d "${ZDOTDIR:-$HOME}/.zcompdump"
fi
# load functions
for __auto_laod_func_file in "${0:h}"/functions/**/*(.); do
autoload -Uz "${__auto_laod_func_file:t}"
done
# load completions,alias,config
for __script_file in "${0:h}"/alias/*(.); do
source "${__script_file}"
done