[zsh] Move ZSH init files to zsh/

This commit is contained in:
Eryn Wells 2026-01-24 16:22:22 -08:00
parent 5b567ad2ad
commit f462cf28a7
3 changed files with 0 additions and 0 deletions

9
zsh/zprofile Normal file
View file

@ -0,0 +1,9 @@
# Eryn Wells <eryn@erynwells.me>
zsh_init_profile_functions=( \
connect_ssh_agent \
init_profile_$SYS \
)
do_init_functions zsh_init_profile_functions

58
zsh/zshenv Normal file
View file

@ -0,0 +1,58 @@
# Eryn Wells <eryn@erynwells.me>
# Don't read global startup. It messes things up...
unsetopt GLOBAL_RCS
export SYS=`uname -s | tr A-Z a-z`
function init-env-dotfiles-path
{
local dotfiles_config="$HOME/.config/dotfiles-home"
if [[ -f "$dotfiles_config" ]]; then
export DOTFILES_HOME=$(cat "$dotfiles_config")
return
fi
if [[ -f "$HOME/.dotfiles/setup.sh" ]]; then
export DOTFILES_HOME="$HOME/.dotfiles"
return
fi
echo "WARNING: Couldn't find path to dotfiles" 1>&2
}
function init-env-fpath
{
local -r fpath_candidates=( \
"$DOTFILES_HOME/zsh/${SYS}-functions" \
"$DOTFILES_HOME/zsh/functions" \
)
# Process the array in reverse order (`Oa` means "descending index order",
# in other worse "reverse order"; see PARAMETER EXPANSION section of the man
# pages) so the paths are prepended in the correct order.
for candidate in ${(Oa)fpath_candidates}; do
if [[ ! -d "$candidate" ]]; then
continue
fi
fpath=($candidate $fpath)
done
}
init-env-dotfiles-path
init-env-fpath
autoload -Uz do_init_functions
typeset -a zsh_init_env_functions=( \
init-env \
init-env-default-xdg-vars \
init-env-path \
init-env-tilde-paths \
init-env-python \
init-env-playdate \
init-env-vi \
init-env-$SYS \
)
do_init_functions zsh_init_env_functions

30
zsh/zshrc Normal file
View file

@ -0,0 +1,30 @@
# Eryn Wells <eryn@erynwells.me>
zsh_init_rc_functions=( \
init_rc_fpath_darwin \
init-rc-aliases \
init-rc-ls \
init-rc-prompt \
init-rc-zle \
init-rc-completion \
init-rc-zsh-options \
init-rc-zsh-history \
init-rc-app-environments \
init-rc-$SYS \
)
if [[ -o LOGIN ]]; then
zsh_init_rc_functions+=(
list_tmux_sessions \
)
fi
do_init_functions zsh_init_rc_functions
autoload -Uz bool
autoload -Uz g
autoload -Uz nethack
autoload -Uz pw
autoload -Uz up
autoload -Uz vi
autoload -Uz homebrew-prefix