dotfiles/zsh/zshrc

66 lines
1.3 KiB
Bash
Raw Normal View History

2018-06-15 13:43:04 +00:00
#!/usr/bin/env zsh
2018-02-23 09:38:24 +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 ))"
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
# }}}
for script in functions options path env zplg plugins aliases completion zle prompt colorscheme; do
2019-10-25 17:50:15 +00:00
_perf_timer_start "$script.zsh"
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
if [[ -d "$ZSH_DOTFILES/custom" ]]; then
2021-05-14 08:05:35 +00:00
_perf_timer_start "custom scripts"
for script in $ZSH_DOTFILES/custom/*.zsh; do
source "$script"
done
2021-05-14 08:05:35 +00:00
_perf_timer_stop "custom scripts"
fi
2021-05-10 17:32:38 +00:00
2019-10-25 17:50:15 +00:00
_perf_timer_stop "total"
2019-03-08 18:10:30 +00:00
welcome