19 lines
437 B
Bash
19 lines
437 B
Bash
|
# In case a plugin adds a redundant path entry, remove duplicate entries
|
||
|
# from PATH
|
||
|
#
|
||
|
# This snippet is from Mislav Marohnić <mislav.marohnic@gmail.com>'s
|
||
|
# dotfiles repo at https://github.com/mislav/dotfiles
|
||
|
dedupe_path() {
|
||
|
typeset -a paths result
|
||
|
paths=($path)
|
||
|
|
||
|
while [[ ${#paths} -gt 0 ]]; do
|
||
|
p="${paths[1]}"
|
||
|
shift paths
|
||
|
[[ -z ${paths[(r)$p]} ]] && result+="$p"
|
||
|
done
|
||
|
|
||
|
export PATH=${(j+:+)result}
|
||
|
}
|
||
|
|
||
|
dedupe_path
|