Asdf: command not found: complete

Created on 21 Jun 2016  路  11Comments  路  Source: asdf-vm/asdf

Hi there!
I've just installed asdf for Mac, and every time I start a new zsh it prints the following error:

/Users/user/.asdf/completions/asdf.bash:43: command not found: complete

What can be going wrong?
Thanks in advance!

Most helpful comment

If you're here because of Google, this thread is super old now and the docs have updated. As of 2020-05-05, do this:

# append completions to fpath 
fpath=(${ASDF_DIR}/completions $fpath) 

# initialise completions with ZSH's compinit 
autoload -Uz compinit && compinit

All 11 comments

I'm getting the same error using ZSH on CentOS 7.

This pull request on a different project seems to have a solution:
https://github.com/eddiezane/lunchy/pull/59

Can anyone using zsh confirm which solution is better?

cc: @asdf-vm/maintainers

It's been a while since I haven't used zsh, but #69 should be good!

69 will work for zsh. When this merges, the readme should聽also be updated to say that zsh users don't need to source ./completions/asdf.bash into their profiles since it's auto-loaded via ./asdf.sh

@dbernheisel I think there are two choices:

  • Autoload completions/_asdf, and avoid sourcing completions/asdf.bash, which is what we were doing before
  • Forget about _asdf and use zsh bash compatibility to load completions/asdf.bash

I just merged #69, but I believe we still need to source the file as only _asdf would get autoloaded,
and I would rather avoid maintaining bash and zsh completion separately.
The bash completion currently being superior to the zsh one, I don't think it is worth trying to replicate the functionality under _asdf.

So, if you think it is ok (not being a zsh user myself, I want to be sure this fits everyone need),
I think that we can safely remove _asdf from completions and avoid appending the fpath as
we are not using autoloading here.

Great direction. I like the 2nd option as well. A quick test on my system proves it should work without issue.

This should now be fixed :smile:

If you're here because of Google, this thread is super old now and the docs have updated. As of 2020-05-05, do this:

# append completions to fpath 
fpath=(${ASDF_DIR}/completions $fpath) 

# initialise completions with ZSH's compinit 
autoload -Uz compinit && compinit

thanks @dbernheisel , but where should we put that?

@bernardo-martinez Please check the documentation site as @dbernheisel mentions as it will guide you for your exact OS & Shell combination https://asdf-vm.com/#/core-manage-asdf-vm

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peleteiro picture peleteiro  路  3Comments

robsonpeixoto picture robsonpeixoto  路  4Comments

niksfirefly picture niksfirefly  路  3Comments

Stratus3D picture Stratus3D  路  3Comments

rhiroyuki picture rhiroyuki  路  3Comments