Reliably set up environment to be inherited by non-login shells, including FPATH

This commit is contained in:
Danielle McLean 2016-10-20 11:49:13 +11:00
parent 109ca827b4
commit 8833894671
No known key found for this signature in database
GPG key ID: CC91589719027E94
3 changed files with 11 additions and 4 deletions

5
config/zsh/all/env Normal file
View file

@ -0,0 +1,5 @@
#! zsh
# We can't inherit the uniqueness flag -U through the environment, so it must
# be established in every Zsh to guarantee these parameters actually contain
# only unique values.
typeset -U cdpath fpath mailpath manpath path pythonpath

View file

@ -1,5 +1,7 @@
#! zsh
fpath=($ZDOTDIR/functions $fpath)
# filter out duplicates, nonexistent directories, and . (the current directory)
fpath=(${(u)^fpath:#.}(N))
# FPATH isn't exported by default like PATH is - to inherit the setting in
# non-login shells, we need to export it ourselves.
typeset -x FPATH

View file

@ -1,7 +1,6 @@
#! zsh
path=(/usr/local/bin $path)
if whence brew >/dev/null; then
if (( $+commands[brew] )); then
path=(
/usr/local/opt/coreutils/libexec/gnubin
/usr/local/sbin
@ -13,5 +12,6 @@ fi
path=(/usr/local/texlive/20*/bin/universal-*(N) $path)
path=(~/bin ~/.bin ~/.local/bin $path)
# filter out duplicates, nonexistent directories, and . (the current directory)
# Filter out nonexistent directories, . (the current directory), and duplicate
# paths - there should be no duplicates because of -U but just to be sure. ;)
path=(${(u)^path:#.}(N))