]> arthur.barton.de Git - ax-zsh.git/commitdiff
Fix PATH environment after plugins ran
authorAlexander Barton <alex@barton.de>
Tue, 28 Dec 2021 13:15:09 +0000 (14:15 +0100)
committerAlexander Barton <alex@barton.de>
Tue, 28 Dec 2021 13:15:11 +0000 (14:15 +0100)
This is especially important to keep the desired search order in place
when other plugins appended/prepended paths.

core/30_path/30_path.zprofile
core/50_path/50_path.zprofile [new file with mode: 0644]

index 32da563c4d05606a83db20042c40a742c965ddea..a15e00620734499a6e67c0e80d22f401f3e9859c 100644 (file)
@@ -10,38 +10,43 @@ fi
 typeset -Ux PATH
 typeset -U path
 
-# Prepend additional search paths
-for d (
-       /Developer/usr/bin
-       /usr/ucb
-       /usr/pkg/bin
-       /usr/local/bin
-       /usr/local/sbin
-       /opt/*/bin(NOn)
-       /opt/*/sbin(NOn)
-       /home/linuxbrew/.linuxbrew/bin
-       /home/linuxbrew/.linuxbrew/sbin
-       ~/.linuxbrew/bin
-       ~/.linuxbrew/sbin
-       ~/.gem/ruby/*/bin(NOn)
-       ~/.go/bin
-       ~/.cargo/bin
-       ~/.local/bin
-       ~/bin
-       ~/sbin
-       ~/Applications
-); do
-       [[ -d "$d" ]] && path=("$d" $path)
-done
+_axzsh_setup_path() {
+       # Prepend additional search paths
+       for d (
+               /Developer/usr/bin
+               /usr/ucb
+               /usr/pkg/bin
+               /usr/local/bin
+               /usr/local/sbin
+               /opt/*/bin(NOn)
+               /opt/*/sbin(NOn)
+               /home/linuxbrew/.linuxbrew/bin
+               /home/linuxbrew/.linuxbrew/sbin
+               ~/.linuxbrew/bin
+               ~/.linuxbrew/sbin
+               ~/.gem/ruby/*/bin(NOn)
+               ~/.go/bin
+               ~/.cargo/bin
+               ~/.local/bin
+               ~/bin
+               ~/sbin
+               ~/Applications
+       ); do
+               [[ -d "$d" ]] && path=("$d" $path)
+       done
+
+       # Append additional search paths
+       for d (
+               /usr/X11/bin
+               /usr/local/games
+               /usr/games
+       ); do
+               [[ -d "$d" ]] && path=($path "$d")
+       done
+}
 
-# Append additional search paths
-for d (
-       /usr/X11/bin
-       /usr/local/games
-       /usr/games
-); do
-       [[ -d "$d" ]] && path=($path "$d")
-done
+# Prepend and append search paths (in a special order!)
+_axzsh_setup_path
 
 # Set default MANPATH
 MANPATH="$(manpath -q)" 2>/dev/null
diff --git a/core/50_path/50_path.zprofile b/core/50_path/50_path.zprofile
new file mode 100644 (file)
index 0000000..eaab8fd
--- /dev/null
@@ -0,0 +1,9 @@
+# # AX-ZSH: Alex' Modular ZSH Configuration
+# 50_path.zprofile: Fix PATH environment after plugins ran
+
+# Prepend and append search paths (in a special order!)
+_axzsh_setup_path
+unfunction _axzsh_setup_path
+
+typeset -Ux PATH MANPATH
+typeset -U path manpath