dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

Include `typeset -U path` in dotfiles

Open SebiBasti opened this issue 1 year ago • 4 comments

Over time the $PATH variable can get quite bloated and have many duplicates inside.

typeset -U path

This takes care of this and checks path to only include unique values e.g. it deletes all duplicates.

https://zsh.sourceforge.io/Guide/zshguide02.html#l24

SebiBasti avatar Apr 09 '23 19:04 SebiBasti

Where would it make sense to add this?

ssaunier avatar May 14 '23 17:05 ssaunier

I currently have it in the bottom half of my .zshrc and had no issues.

SebiBasti avatar May 22 '23 09:05 SebiBasti

I checked again with the help of chatGPT:

Putting it all together, the code typeset -U path is instructing the shell to modify the path variable and
ensure that it contains only unique elements. It is useful in scenarios where you want to avoid 
having duplicate directory paths in the PATH variable.

I think there's no risk in including it in .zshrc.

SebiBasti avatar May 22 '23 09:05 SebiBasti

I created a PR 👌

SebiBasti avatar May 22 '23 14:05 SebiBasti