ZSH: Restructured path settings
This commit is contained in:
parent
360e82abe9
commit
7014435399
@ -1,19 +1,18 @@
|
||||
# Set $PATH
|
||||
# Put only directories in $PATH that exist and remove duplicates
|
||||
typeset -U path # No duplicates
|
||||
typeset -U path # No duplicates
|
||||
path=()
|
||||
|
||||
_prepath() {
|
||||
for dir in "$@"; do
|
||||
dir=${dir:A}
|
||||
[[ ! -d "$dir" ]] && return
|
||||
#path=("$dir" $path[@])
|
||||
path=("$dir" $path)
|
||||
done
|
||||
for dir in "$@"; do
|
||||
dir=${dir:A}
|
||||
[[ ! -d "$dir" ]] && return
|
||||
path=("$dir" $path)
|
||||
done
|
||||
}
|
||||
|
||||
_prepath /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/sbin # BSD and macOS
|
||||
_prepath /opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin # Homebrew on macOS
|
||||
_prepath ~/bin ~/.local/bin # $HOME
|
||||
_prepath /opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin # Homebrew on macOS
|
||||
_prepath ~/bin ~/.local/bin # $HOME
|
||||
|
||||
unfunction _prepath
|
||||
|
Loading…
Reference in New Issue
Block a user