]> arthur.barton.de Git - ax-zsh.git/commitdiff
Add "40_path" plugin to initialize PATH and MANPATH
authorAlexander Barton <alex@barton.de>
Thu, 16 Jul 2015 22:38:18 +0000 (00:38 +0200)
committerAlexander Barton <alex@barton.de>
Thu, 16 Jul 2015 22:38:18 +0000 (00:38 +0200)
core/40_path/40_path.zprofile [new file with mode: 0644]

diff --git a/core/40_path/40_path.zprofile b/core/40_path/40_path.zprofile
new file mode 100644 (file)
index 0000000..59f9b75
--- /dev/null
@@ -0,0 +1,29 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# 40_path.zprofile: Setup PATH environment
+
+# Set default PATH
+export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
+
+# Set default MANPATH
+export MANPATH="$(manpath)" 2>/dev/null
+if [[ $? -ne 0 ]]; then
+       MANPATH="/usr/share/man"
+       for d (/usr/local/share/man /opt/*/man(N)); do
+               [ -d "$d" ] && MANPATH="$MANPATH:$d"
+       done
+fi
+
+# Prepend additional search paths
+for d (/usr/local/bin /usr/local/sbin ~/Applications(N)); do
+       [ -d "$d" ] && PATH="$d:$PATH"
+done
+
+# Append additional search paths
+for d (/opt/*/sbin /opt/*/bin(N)); do
+       [ -d "$d" ] && PATH="$PATH:$d"
+done
+
+if [[ -x /usr/libexec/path_helper ]]; then
+       # Update PATH using "path_helper(1)", when available
+       eval "$(/usr/libexec/path_helper)"
+fi