zsh: Remove zshenv

The code conditionally sourcing zprofile moved to the generated .zshenv
zsh/zshenv was otherwise empty and is now one file less zsh has to open on
startup.

install needs to be re-run to update the generated .zshenv
master
Taeyeon Mori 7 years ago
parent 1b78d7734d
commit 67de196e8a
  1. 3
      install
  2. 21
      zsh/zprofile
  3. 11
      zsh/zshenv

@ -161,7 +161,8 @@ color 32 echo " Writing .zshenv"
generate "$HOME/.zshenv" <<EOF generate "$HOME/.zshenv" <<EOF
export DOTFILES="\$HOME/$(relpath "$DOT" "$HOME")" export DOTFILES="\$HOME/$(relpath "$DOT" "$HOME")"
ZDOTDIR="\$DOTFILES/zsh" ZDOTDIR="\$DOTFILES/zsh"
source "\$ZDOTDIR/zshenv" [[ -f "\$ZDOTDIR/zshenv" ]] && source "\$ZDOTDIR/zshenv"
[[ ! -o LOGIN && "\$SHLVL" == 1 && -f "\$ZDOTDIR/zprofile" ]] && source "\$ZDOTDIR/zprofile"
EOF EOF
for file in zshrc zpreztorc zlogin zlogout zprofile; do for file in zshrc zpreztorc zlogin zlogout zprofile; do

@ -1,25 +1,20 @@
# vim: ft=zsh # vim: ft=zsh
# #
# Executes commands in every top-level shell # Executes commands in every top-level or login shell
# #
# ATTENTION: This differs from usual zsh behaviour! # ATTENTION: This differs from usual zsh behaviour! In addition to traditional
# Treat this file as a per-session zshenv instead. # login shells, this is also sourced by any top-level ($SHLVL=1)
# non-login shells. (In the latter case, from zshenv)
# #
# Why is this useful? Because it only gets executed once for any given tree # This is useful because it only gets executed once for any given tree
# of zsh-processes. You can use it to do environment computations that would # of zsh-processes, saving resources on sub-shell invocation while still
# be too expensive for zshenv. # providing a consistent environment in login and non-login shells.
# #
# Then why also source it in non-interactive shells? # Then why also source it in non-interactive shells?
# Because it prevents desync between scripts and interactive prompts. # Because it prevents desync between scripts and interactive prompts.
# Ever tried to debug a script and ended up with "But it works in the prompt!"? # Ever tried to debug a script and ended up with "But it works in the prompt!"?
# #
# That is especially true with X11-Scenarios, since a display-manager usually # For code intended for login shells only, use zlogin instead.
# doesn't source any profile. Which will lead to shells without a login shell in
# their parent process tree, which means the profile is basically useless.
#
# If you need loginshell-only commands, use zlogin instead. If you insist on
# zprofile, create a .zprofile (note the dot) file in this directory and zsh will
# treat it as always.
# #
# #

@ -1,11 +0,0 @@
#
# Defines environment variables.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Source the profile on every top-level shell
if [[ "$SHLVL" -eq 1 && ! -o LOGIN ]]; then
source "$DOTFILES/zsh/zprofile"
fi
Loading…
Cancel
Save