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

Basic installation doesn't work on macOS with zsh #95

Open
ZacSweers opened this issue Aug 4, 2020 · 5 comments
Open

Basic installation doesn't work on macOS with zsh #95

ZacSweers opened this issue Aug 4, 2020 · 5 comments

Comments

@ZacSweers
Copy link

ZacSweers commented Aug 4, 2020

❯ brew install gradle-completion

❯ echo $fpath | grep "/usr/local/share/zsh/site-functions"
/Users/zsweers/.oh-my-zsh/plugins/git /Users/zsweers/.oh-my-zsh/functions /Users/zsweers/.oh-my-zsh/completions /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.7.1/functions

cd <our project>

❯ source ~/.zsh/gradle-completion/_gradle 1>&2 2>/dev/null; __gradle-completion-init
zsh: command not found: __gradle-completion-init

~/.zsh/gradle-completion doesn't exist, is there some undocumented intermediary step required?

@mdemaso
Copy link

mdemaso commented Aug 10, 2020

Try quitting Terminal and re-opening it. This was a required step that I had to do to get it to work properly.

@jkaan
Copy link

jkaan commented Oct 26, 2020

The issue is that the manual install step would put the _gradle file in this spot: ~/.zsh/gradle-completion/_gradle. However, running brew install gradle-completion puts the file in /usr/local/share/zsh/site-functions/_gradle.

So if you run source /usr/local/share/zsh/site-functions/_gradle 1>&2 2>/dev/null; __gradle-completion-init. Then it'll work.

I ran into this same issue :).

Edit: Running ./gradlew will also generate the cache of course

@tinder-haroldmartin
Copy link

I am getting this error

% source /usr/local/share/zsh/site-functions/_gradle
_gradle:6: command not found: _arguments
__gradle_tasks:20: command not found: _describe

After which I can't get autocomplete working following the above steps or the troubleshooting steps in readme 😞

@saket
Copy link

saket commented Feb 1, 2022

I'm running into the same problem! Is homebrew not the recommended way to install gradle-completion?

@qoomon
Copy link

qoomon commented Jun 24, 2022

just add following snippet to your .zshrc

if [ $commands[brew] ]
then
  fpath=("$(brew --prefix)/share/zsh/site-functions" $fpath)
fi

see https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants