unixorn / fzf-zsh-plugin

ZSH plugin to enable fzf searches of a lot more stuff - docker, tmux, homebrew and more.
Apache License 2.0
312 stars 29 forks source link

Add path check before adding to user path #96

Closed Archangel33 closed 8 months ago

Archangel33 commented 8 months ago

I am currently tweaking my zsh config, and in turn sourcing my .zshrc quite often, and I noticed the path to this plugins bin directory is being added multiple times to my PATH variable. I took a quick look, and I think there should be a check for if the bin path is already present on the user path before adding it to the users PATH variable. I believe this line: https://github.com/unixorn/fzf-zsh-plugin/blob/480cbd0cdf1ef03b87c194c1b4c9d438b201c4fd/fzf-zsh-plugin.plugin.zsh#L17 should be wrapped with a check, something like this:

if [[ ! "$path" == *${FZF_PLUGIN_BIN}* ]]; then
  path+=(${FZF_PLUGIN_BIN})
fi
unixorn commented 8 months ago

TIL, I'll have to update my other plugins too.