#!/usr/bin/env zsh ZSH_DOTFILES="${0:h}" autoload -U colors && colors # Performance {{{ zmodload zsh/datetime typeset -A _perf_timers _perf_timer_start() { local name="$1" if [[ -z "$name" ]]; then print >&2 "$0: usage: $0 " return 1 fi _perf_timers[$name]="$EPOCHREALTIME" } _perf_timer_stop() { local name="$1" if [[ -z "$name" ]]; then print >&2 "$0: usage: $0 " 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" } # }}} _perf_timer_start "total" # 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 some reason manpath is not always set when logging with ssh for instance. # Let's ensure that it is always set and exported. The additional colon ensures # that the system manpath isn't overwritten (see manpath(1)), though in reality # two colons get added for some reason, which is also valid, but means # something slightly different (again, see manpath(1)). Hope this won't cause # any problems in the future. export MANPATH="$MANPATH:" for script in functions options path env plugins aliases completion zle prompt colorscheme; do _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh" _perf_timer_stop "$script.zsh" done command_exists rbenv && eval "$(rbenv init -)" _perf_timer_stop "total" welcome