4

I've been using oh-my-zsh for a while and it's working great. I'd like to use the command-line fuzzy finder plugin so I enabled it in .zshrc:

plugins=(fzf)

However if "fzf" is not installed I get a warning when opening my terminal window:

[oh-my-zsh] fzf plugin: Cannot find fzf installation directory. Please add export FZF_BASE=/path/to/fzf/install/dir to your .zshrc

Is there a way to hide that warning message? When I install fzf with "sudo dnf install fzf" the warning dissapears, but maybe I want to clone my dotfiles on a different computer where it is not available and it's not that important to be there.

Zoltan King
  • 1,786
  • 4
  • 15
  • 27

4 Answers4

1

You need to have fzf installed to use this plugin; otherwise remove it. It won't do anything without first installing fzf. Sudo apt install fzf

Micheal Bee
  • 334
  • 3
  • 8
0

you should first install fzf, in Mac and i use the following command to install brew install fzf

dadanier
  • 121
  • 2
  • 6
0

You can put the plugins= line inside an if statement that checks for the presence of fzf in your path. For example:

if [[ -n $(command -v fzf) ]] ; then
    echo "fzf found, loading oh-my-zsh fzf plugin"
    plugins=(vi-mode fzf)
else
    echo "no fzf was found in the path"
    plugins=(vi-mode)
fi

command -v is similar to which, but is superior for this context as explained in this answer. The -n makes the [[ ]] evaluate as true whenever the $() produces a non-empty output.

xxyxxyxyx1
  • 69
  • 6
0

For me, it was also very important that brew itself was in Path of ~/.zshenv like so:

export PATH=/opt/homebrew/bin:$PATH 

Installed FZF with brew on an M1 Mac.

Otherwise, the error occurs:

[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.
Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc
flymg
  • 370
  • 2
  • 13