[ZSH] Reload zsh on dotfiles update

This commit is contained in:
Fabian Ising
2025-12-31 13:15:21 +01:00
parent dc9ed93732
commit 02e434f0b2

View File

@@ -1,5 +1,6 @@
export PATH="/snap/bin:$HOME/.local/bin:$HOME/dotfiles/scripts:$PATH"
export XDG_CONFIG_HOME="$HOME/.config" # Fix nvim bug
DOTFILES_UPDATED=0
[[ -z $SSH_AUTH_SOCK ]] || export FORWARD_SOCK=$SSH_AUTH_SOCK
@@ -29,6 +30,7 @@ update_dotfiles() {
cd ~/dotfiles || return
if git fetch --dry-run 2>&1 | grep -q .; then
git pull > /dev/null 2>&1
DOTFILES_UPDATED=1
fi
}
@@ -40,8 +42,10 @@ if [ "$shared_config" -eq 0 ]; then
export GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
fi
# If the dotfiles were updated, we are sourcing this file again
if [ "$DOTFILES_UPDATED" -eq 1 ]; then
source .zshrc
else
# Load Antidote
mkdir -p ${ZDOTDIR:-~}/.cache/zsh
static_file=${ZDOTDIR:-~}/.cache/zsh/.zsh_plugins.zsh
@@ -147,3 +151,4 @@ export TIME_STYLE="long-iso"
[[ -f ~/.zsh/.virtual_env_config.zsh ]] && source ~/.zsh/.virtual_env_config.zsh
[[ -f ~/.zsh/.local_config ]] && source ~/.zsh/.local_config
[[ -f ~/.zsh/.os_config.zsh ]] && source ~/.zsh/.os_config.zsh
fi