Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zsh tab completion not active by default #8984

Closed
yschimke opened this issue Oct 25, 2020 · 11 comments · Fixed by #9292
Closed

Zsh tab completion not active by default #8984

yschimke opened this issue Oct 25, 2020 · 11 comments · Fixed by #9292
Labels
outdated PR was locked due to age

Comments

@yschimke
Copy link

https://docs.brew.sh/Shell-Completion

https://github.com/Linuxbrew/brew/blob/master/docs/Shell-Completion.md#configuring-completions-in-zsh

It doesn't appear that zsh completion works by default. Even if a user is happily using zsh completion for other commands, homebrew requires explicit extra steps to activate. Could homebrew install zsh completions into the standard locations? Or prompt to automatically insert into the users .zshrc with the specific fix?

@MikeMcQuaid
Copy link
Member

Hi @yschimke, thanks for sponsoring Homebrew! Please always fill out the issue template; it saves us time when triaging issues.

We do install ZSH completions into their standard locations within the Homebrew prefix but unfortunately that's not enough for ZSH to pick them up by default. They need manual configuration in order to avoid security issues.

Does that answer your question?

@yschimke
Copy link
Author

No, I understand the situation. It seems that it means that completions don't work for most users who will install my app.

I'm asking if there is any plan to improve it?

It seems suboptimal if most apps print out instructions to include things in startup scripts.

P.s. I love homebrew. The sponsorship is unrelated and very minimal.

@MikeMcQuaid
Copy link
Member

It seems that it means that completions don't work for most users who will install my app.

Is your app installed by Homebrew?

I'm asking if there is any plan to improve it?

I don't think we can set this automatically, unfortunately 😭. We do notify users when applications install ZSH completions with setup instructions.

P.s. I love homebrew. The sponsorship is unrelated and very minimal.

Thanks! Very related in my mind ❤️!

@yschimke
Copy link
Author

Yep - three small CLIs

https://github.com/yschimke/homebrew-tap/blob/master/rsocket-cli.rb
https://github.com/yschimke/homebrew-tap/blob/master/okurl.rb
https://github.com/yschimke/homebrew-tap/blob/master/cooee.rb

I was hoping to get as closed to one command install, but noone I've tested with has had the final step of zsh completion already set up, so installing these commands for a friend testing something means explaining the additional set of completion files they need to register.

$  tail -7 ~/.zshrc
if type brew &>/dev/null; then
  FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH

  autoload -Uz compinit
  compinit
fi

@yschimke
Copy link
Author

Feel free to close if it's not worth the hassle.

@MikeMcQuaid
Copy link
Member

@yschimke I see:

==> Installing rsocket-cli from yschimke/tap
==> Downloading https://jitpack.io/com/github/rsocket/rsocket-cli/1.26/rsocket-cli-1.26.tar
######################################################################## 100.0%
==> Caveats
zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

Do you think this message should be better adapted to explain how to setup completion if it isn't already?

@yschimke
Copy link
Author

Do you think this message should be better adapted to explain how to setup completion if it isn't already?

+100, ideally detect if it's already in fpath of the user running the install, and if not explain the steps to fix!

@alperenkilic
Copy link

I am using zsh, I could not install home-brew. when I used to Mac ons bsh I could install easily. But I can not install that now. I am tried brew command install methods. Also I can use git but my zsh terminal why do not see brew?
Ekran Resmi 2020-10-28 08 35 50

@yschimke
Copy link
Author

I am using zsh, I could not install home-brew. when I used to Mac ons bsh I could install easily. But I can not install that now. I am tried brew command install methods. Also I can use git but my zsh terminal why do not see brew?
Ekran Resmi 2020-10-28 08 35 50

@alperenkilic I think this is a differnt topic that deserves it's own issue.

@yschimke
Copy link
Author

n.b. gradle-completion page has incrrect steps for this, since homebrew location isn't hardcoded.

https://github.com/gradle/gradle-completion

# Ensure /usr/local/share/zsh/site-functions is on $fpath. You should get a result from the following
echo $fpath | grep "/usr/local/share/zsh/site-functions"

The motivation factor to get this working probably means that only the developer who writes the completion to scratch an itch gets the benefit, while everyone else blindly misses that it is not configured.

@MikeMcQuaid
Copy link
Member

Have opened #9292, let me know what you think.

@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 27, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants