]> arthur.barton.de Git - ax-zsh.git/commitdiff
Look for configuration files in $ZDOTDIR
authorAlexander Barton <alex@barton.de>
Sun, 11 Dec 2022 14:36:25 +0000 (15:36 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 11 Dec 2022 14:36:25 +0000 (15:36 +0100)
This allows you to set/override the ZDOTDIR environment variable in your
~/.zshenv file to have different "sets" of AX-ZSH configurations in
different ZDOTDIR folders. For example, for different terminal emulator
applications, system architectures or hosts.

If ZDOTDIR is not set, $HOME is used (so no functional changes when the
ZDOTDIR environment variable is not set).

ax.zsh
install.sh

diff --git a/ax.zsh b/ax.zsh
index e21b24657409a85f3d20b5f73a3329a7036a3ffa..b2ee3db9856624f9e2a2c9859f31026d6db70a36 100644 (file)
--- a/ax.zsh
+++ b/ax.zsh
@@ -228,7 +228,7 @@ fi
 [[ -n "$SHELL" ]] || export SHELL=$(command -v zsh)
 
 # Make sure that "AXZSH" variable is set and exported
-[[ -n "$AXZSH" ]] || export AXZSH="$HOME/.axzsh"
+[[ -n "$AXZSH" ]] || export AXZSH="${ZDOTDIR:-$HOME}/.axzsh"
 
 # Check for "debug mode" ...
 if [[ -f "$AXZSH/debug" || -f "$HOME/.axzsh.debug" ]]; then
index 4c5019787ae77950de538518b9e1e9add7812def..6d7b22a2490bda835f9d6e98ddfe5894d4973451 100755 (executable)
@@ -35,7 +35,7 @@ abort() {
 
 umask 027
 
-[ -n "$AXZSH" ] || AXZSH="$HOME/.axzsh"
+[ -n "$AXZSH" ] || AXZSH="${ZDOTDIR:-$HOME}/.axzsh"
 export AXZSH
 
 S=$(dirname "$0")
@@ -79,7 +79,12 @@ mkdir -p "$AXZSH/custom_themes" || abort
 
 ax_msg - "Linking ZSH startup files ..."
 
-for f in ~/.zlogin ~/.zlogout ~/.zprofile ~/.zshrc; do
+for f in \
+       ${ZDOTDIR:-$HOME}/.zlogin \
+       ${ZDOTDIR:-$HOME}/.zlogout \
+       ${ZDOTDIR:-$HOME}/.zprofile \
+       ${ZDOTDIR:-$HOME}/.zshrc \
+; do
        safe_rm "$f" || abort
        ln -sv "$AXZSH/ax.zsh" "$f" || abort
 done