Aloxaf / fzf-tab

Replace zsh's default completion selection menu with fzf!
MIT License
3.28k stars 94 forks source link

fix: Only add to `$FPATH` once #324

Closed dmorgan-fa closed 1 year ago

dmorgan-fa commented 1 year ago

What

Rather than adding to $FPATH every time a new shell is created, check to see if it's already present. This means we don't end up with multiple instances of ${FZF_TAB_HOME}/lib included in $FPATH.

Example

Before

$ echo $FPATH | tr ":" "\n"
[...]
${HOME}/fzf-tab/lib
$ zsh   # open a subshell
$ echo $FPATH | tr ":" "\n"
[...]
${HOME}/fzf-tab/lib
${HOME}/fzf-tab/lib

After

$ echo $FPATH | tr ":" "\n"
[...]
${HOME}/fzf-tab/lib
$ zsh   # open a subshell
$ echo $FPATH | tr ":" "\n"
[...]
${HOME}/fzf-tab/lib
Aloxaf commented 1 year ago

Sorry, I cannot reproduce this. What's your zsh version?

图片

dmorgan-fa commented 1 year ago

Ah, I see it's only happening on my Mac:

zsh 5.8.1 (x86_64-apple-darwin22.0)

I get the same experience on Ubuntu as you, without the duplicate entries in $fpath:

zsh 5.8 (x86_64-ubuntu-linux-gnu)
Aloxaf commented 1 year ago

Thanks for your contribution!