Start Refactoring to composable zsh config modules
This commit is contained in:
parent
764de81461
commit
71a7ca83c6
24 changed files with 643 additions and 296 deletions
19
.zsh.d/31-deduplicate-path-variable
Normal file
19
.zsh.d/31-deduplicate-path-variable
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue