2018-06-15 13:43:04 +00:00
|
|
|
#!/usr/bin/env zsh
|
2018-02-23 09:38:24 +00:00
|
|
|
|
2019-04-22 15:07:02 +00:00
|
|
|
ZSH_DOTFILES="${0:h}"
|
2018-02-23 09:38:24 +00:00
|
|
|
|
2019-09-24 19:34:15 +00:00
|
|
|
autoload -U colors && colors
|
|
|
|
|
2019-10-25 17:50:15 +00:00
|
|
|
# Performance {{{
|
|
|
|
|
|
|
|
zmodload zsh/datetime
|
|
|
|
typeset -A _perf_timers
|
|
|
|
|
|
|
|
_perf_timer_start() {
|
|
|
|
local name="$1"
|
|
|
|
if [[ -z "$name" ]]; then
|
|
|
|
print >&2 "$0: usage: $0 <name>"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
_perf_timers[$name]="$EPOCHREALTIME"
|
|
|
|
}
|
|
|
|
|
|
|
|
_perf_timer_stop() {
|
|
|
|
local name="$1"
|
|
|
|
if [[ -z "$name" ]]; then
|
|
|
|
print >&2 "$0: usage: $0 <name>"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
local stop_time="$EPOCHREALTIME" start_time="${_perf_timers[$name]}"
|
|
|
|
local -i duration="$(( (stop_time - start_time) * 1000 ))"
|
2019-11-09 23:09:41 +00:00
|
|
|
print -- "$(print -P '%F{8}==>%f') ${name}: ${duration}ms"
|
2019-10-25 17:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
|
|
|
|
_perf_timer_start "total"
|
|
|
|
|
2020-01-05 11:58:58 +00:00
|
|
|
# platform identification {{{
|
|
|
|
if [[ "$OSTYPE" == linux* ]]; then
|
|
|
|
_is_linux=1
|
|
|
|
if [[ "$OSTYPE" == linux-android ]]; then
|
|
|
|
_is_android=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$OSTYPE" == darwin* ]]; then
|
|
|
|
_is_macos=1
|
|
|
|
fi
|
|
|
|
# }}}
|
|
|
|
|
2019-12-25 22:04:52 +00:00
|
|
|
for script in functions options path env plugins aliases completion zle prompt colorscheme; do
|
2019-10-25 17:50:15 +00:00
|
|
|
_perf_timer_start "$script.zsh"
|
2019-04-22 15:07:02 +00:00
|
|
|
source "$ZSH_DOTFILES/$script.zsh"
|
2019-10-25 17:50:15 +00:00
|
|
|
_perf_timer_stop "$script.zsh"
|
2018-11-10 14:51:47 +00:00
|
|
|
done
|
|
|
|
|
2019-05-05 23:24:22 +00:00
|
|
|
command_exists rbenv && eval "$(rbenv init -)"
|
|
|
|
|
2019-10-25 17:50:15 +00:00
|
|
|
_perf_timer_stop "total"
|
|
|
|
|
2019-03-08 18:10:30 +00:00
|
|
|
welcome
|