]> arthur.barton.de Git - ax-zsh.git/commitdiff
01_zprofile & 99_zlogin: Make sure z{profile|login} is read
authorAlexander Barton <alex@barton.de>
Mon, 6 Jul 2015 21:30:30 +0000 (23:30 +0200)
committerAlexander Barton <alex@barton.de>
Mon, 6 Jul 2015 21:30:30 +0000 (23:30 +0200)
Make sure that all the z{profile|login} plugins have been read, in
the current (login) ZSH, or in an parent ZSH, and read them in before
and after all the "zshrc" files if not.

core/01_zprofile/01_zprofile.zprofile [new file with mode: 0644]
core/01_zprofile/01_zprofile.zshrc [new file with mode: 0644]
core/99_zlogin/99_zlogin.zlogin [new file with mode: 0644]
core/99_zlogin/99_zlogin.zshrc [new file with mode: 0644]

diff --git a/core/01_zprofile/01_zprofile.zprofile b/core/01_zprofile/01_zprofile.zprofile
new file mode 100644 (file)
index 0000000..e914645
--- /dev/null
@@ -0,0 +1,4 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 01_zprofile.zprofile: Initialize AX-ZSH profile settings
+
+AXZSH_ZPROFILE_READ=1
diff --git a/core/01_zprofile/01_zprofile.zshrc b/core/01_zprofile/01_zprofile.zshrc
new file mode 100644 (file)
index 0000000..5b6493e
--- /dev/null
@@ -0,0 +1,17 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 01_zprofile.zshrc: Make sure zpfofile files are read
+
+[[ -z "$AXZSH_ZPROFILE_READ" ]] || return
+
+# No "zprofile" files have been read in already! So most probably this
+# ZSH instance hasn't been called from an ax-zsh enabled ZSH!
+
+# Reset some environment variables, that could contain "garbage" ...
+unset PS1
+
+[[ -f "$HOME/.axzsh.debug" ]] && echo "» 01_zprofile.zsh:"
+for plugin ($plugin_list); do
+       axzsh_load_plugin "$(basename "$plugin")" "zprofile"
+done
+AXZSH_ZPROFILE_READ=2
+[[ -f "$HOME/.axzsh.debug" ]] && echo "» 01_zprofile.zsh (end)"
diff --git a/core/99_zlogin/99_zlogin.zlogin b/core/99_zlogin/99_zlogin.zlogin
new file mode 100644 (file)
index 0000000..69586df
--- /dev/null
@@ -0,0 +1,5 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 99_zlogin.zlogin: Mark AX-ZSH zprofile/zlogin as read
+
+export AXZSH_ZPROFILE_READ=1
+export AXZSH_ZLOGIN_READ=1
diff --git a/core/99_zlogin/99_zlogin.zshrc b/core/99_zlogin/99_zlogin.zshrc
new file mode 100644 (file)
index 0000000..4f96617
--- /dev/null
@@ -0,0 +1,14 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 99_zlogin.zshrc: Make sure zpfofile files are read
+
+[[ "$AXZSH_ZPROFILE_READ" = "2" ]] || return
+
+# No "zlogin" files have been read in already! So most probably this
+# ZSH instance hasn't been called from an ax-zsh enabled ZSH!
+
+[[ -f "$HOME/.axzsh.debug" ]] && echo "» 99_zlogin.zsh:"
+for plugin ($plugin_list); do
+       axzsh_load_plugin "$(basename "$plugin")" "zlogin"
+done
+AXZSH_ZLOGIN_READ=2
+[[ -f "$HOME/.axzsh.debug" ]] && echo "» 99_zlogin.zsh (end)"