From c719fad76a7ee3f84339b93ee9b3dc629e4166b9 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Sun, 23 Aug 2020 11:08:59 +0100 Subject: [PATCH] zsh: skip loading environment if ZDOTDIR is set Loading the environment on every shell invocation is slow. We can speed up shell startup a little by skipping this for ever shell because it's loaded on login by systemd. Signed-off-by: Joe Groocock --- zsh/.zshenv | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/zsh/.zshenv b/zsh/.zshenv index cdffe65..0d17869 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,5 +1,11 @@ -set -o allexport -. ~/.config/environment.d/*.conf -set +o allexport +# Assume environment is already loaded if ZDOTDIR is set. +# This speeds up starting zsh if it's not required. Attempt +# to load the environment if it's absent, though, in case +# ZDOTDIR is overriden and .zshrc is not in ~ +if [ -z "$ZDOTDIR" ]; then + set -o allexport + . ~/.config/environment.d/*.conf + set +o allexport +fi # vim: ft=sh