Completion and fish not working

Hello, I’ve got a problem with fish and autocompletion.
On the official docs it’s stated that no configuration is needed for fish.
But for me the completion is not working with fish… I tried different formulae (e.g. gh-cli) but none of them works, so I’m starting to think that some configuration is needed maybe. I have fish 3.1.2 and latest version of homebrew (2.4.3-14-g9fc0799). Suggestions?

I do have these configurations in my config.fish. I’m not sure when I added them or if it’s needed.

if test -d (brew --prefix)"/share/fish/completions"
    set -g -x fish_complete_path $fish_complete_path (brew --prefix)/share/fish/completions
end

if test -d (brew --prefix)"/share/fish/vendor_completions.d"
    set -g -x fish_complete_path $fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
end

Is your fish from Homebrew or your distro? Homebrew fish gives you Homebrew completions out of the box because it’s pre-configured at build time to look in $HOMEBREW_PREFIX/share/fish/vendor_completions.d…and Homebrew already puts the necessary files there.

If your fish is a distro one, do what @SMillerDev posted.

For more info, read https://fishshell.com/docs/current/index.html#where-to-put-completions

Thank you guys! Now it’s working! The problem was coming from the fact that I installed fish not using homebrew but from the official fish PPA and I did not have the fish_complete_path set the correct way in config.fish.
Maybe what @gromgit said should be stated in the official homebrew configuration? For me was not trivial.

I’ve already submitted a documentation PR: https://github.com/Homebrew/brew/pull/7894

1 Like