The new axzshctl function, which shadows the axzshctl shell script,
tries to detect when there potentially were changes to the setup and
restarts the running shell in that case, bringing the new configuration
in effect immediately.
Now the user doesn't have to restart his shell manually any more.
# AX-ZSH: Alex' Modular ZSH Configuration
# 50_axzsh.zshrc: Initialize AX-ZSH
-alias axzshctl="nocorrect zsh $AXZSH/bin/axzshctl"
+function axzshctl() {
+ zsh "$AXZSH/bin/axzshctl" "$@" || return $?
+
+ case "$1" in
+ "disable"*|"enable"*|"reset"*|"set"*|"up"*)
+ # Command which potentially "changed state".
+ if [[ -o login ]]; then
+ echo "Restarting login shell ..."
+ exec -l "$SHELL"
+ else
+ echo "Restarting shell ..."
+ exec "$SHELL"
+ fi
+ ;;
+ esac
+ return 0
+}