From 091449f6044a2c5ae2087dc69fbf4780871ace2a Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 10 May 2021 20:38:37 +0200 Subject: [PATCH] [zsh] Reimplement loading of custom scripts. --- zsh/functions.zsh | 4 ++++ zsh/zshrc | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index bbf832c..f161e0d 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -6,6 +6,10 @@ bytecount() { wc -c "$@" | numfmt --to=iec-i; } mkcd() { mkdir -p "$@" && cd "${@[-1]}"; } +# Re-added from: +# https://github.com/dmitmel/dotfiles/blob/16f0a1cf32ec97355da2e17de1c4bb458431767b/zsh/functions.zsh#L19 +source_if_exists() { [[ -f "$1" ]] && source "$1" } + silence() { $1 &>/dev/null } viscd() { diff --git a/zsh/zshrc b/zsh/zshrc index 87660f3..7a099d9 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -52,11 +52,13 @@ for script in functions options path env plugins aliases completion zle prompt c _perf_timer_stop "$script.zsh" done -for script in $ZSH_DOTFILES/custom/**; do - _perf_timer_start "$script" - source "$script" - _perf_timer_stop "$script" -done +if [[ -d "$ZSH_DOTFILES/custom" ]]; then + for script in $ZSH_DOTFILES/custom/*.zsh; do + _perf_timer_start "custom/${script##*/}" + source "$script" + _perf_timer_stop "custom/${script##*/}" + done +fi command_exists rbenv && eval "$(rbenv init -)"