[zsh] Give all the init-env functions consistent names

This commit is contained in:
Eryn Wells 2024-09-24 09:25:09 -07:00
parent e5505a7a69
commit f2144fcbed
8 changed files with 28 additions and 52 deletions

17
zsh/func/init-env-darwin Normal file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function init-env-darwin
{
local -r xcode_library="$HOME/Library/Developer/Xcode"
if [[ -d "$xcode_library" ]]; then
export XCODE_LIBRARY="$xcode_library"
export XCODE_DERIVED_DATA="$XCODE_LIBRARY/DerivedData"
export XCODE_INSTALLS="$XCODE_LIBRARY/Installs"
export dd="$XCODE_DERIVED_DATA"
fi
export df=~/.dotfiles
}
init-env-darwin "$@"

View file

@ -2,7 +2,7 @@
autoload -Uz update-path autoload -Uz update-path
function init-path function init-env-path
{ {
update-path \ update-path \
"$HOME/bin" \ "$HOME/bin" \
@ -23,4 +23,4 @@ function init-path
/sbin /sbin
} }
init-path "$@" init-env-path "$@"

View file

@ -2,7 +2,7 @@
autoload -Uz binary_exists autoload -Uz binary_exists
function init-unix-env function init-env-unix
{ {
export PAGER="less" export PAGER="less"
export MANPAGER=$PAGER export MANPAGER=$PAGER
@ -17,4 +17,4 @@ function init-unix-env
fi fi
} }
init-unix-env "$@" init-env-unix "$@"

View file

@ -1,7 +1,7 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me> # Eryn Wells <eryn@erynwells.me>
function init-vi function init-env-vi
{ {
# Prefer nvim and vim, in that order, over standard vi, which is insufferable. # Prefer nvim and vim, in that order, over standard vi, which is insufferable.
if whence -cp nvim &> /dev/null; then if whence -cp nvim &> /dev/null; then
@ -15,4 +15,4 @@ function init-vi
fi fi
} }
init-vi "$@" init-env-vi "$@"

View file

@ -1,12 +0,0 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
autoload append_to_path
autoload prepend_to_path
export XCODE_LIBRARY="$HOME/Library/Developer/Xcode"
export XCODE_DERIVED_DATA="$XCODE_LIBRARY/DerivedData"
export XCODE_INSTALLS="$XCODE_LIBRARY/Installs"
export dd="$XCODE_DERIVED_DATA"
export df=~/.dotfiles

View file

@ -1,29 +0,0 @@
#!/usr/bin/env zsh
# vim:ft=zsh:
# Eryn Wells <eryn@erynwells.me>
function init_env_darwin_python
{
local pythonRoot
local python27SitePackages
pythonRoot="$HOME/Library/Python"
if [[ -d "$pythonRoot" ]]; then
for f in `ls "$pythonRoot"`; do
prepend_to_path "$pythonRoot/$f/bin"
done
fi
python27SitePackages="$pythonroot/2.7/lib/python/site-packages"
if [[ -d "$python27SitePackages" ]]; then
if [[ ! -z $PYTHONPATH ]]; then
PYTHONPATH=$python27SitePackages:$PYTHONPATH
else
PYTHONPATH=$python27SitePackages
fi
fi
export PYTHONPATH
}
init_env_darwin_python "$@"

10
zshenv
View file

@ -28,13 +28,13 @@ init-env-fpath
autoload -Uz do_init_functions autoload -Uz do_init_functions
typeset -a zsh_init_env_functions=( \ typeset -a zsh_init_env_functions=( \
init-path \ init-env-path \
init-unix-env \ init-env-unix \
init-zsh-helpers \ init-env-zsh-helpers \
init-env-python \ init-env-python \
init-env-playdate \ init-env-playdate \
init-vi \ init-env-vi \
init_env_$SYS \ init-env-$SYS \
) )
do_init_functions zsh_init_env_functions do_init_functions zsh_init_env_functions