4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

zshでのasdfの補完設定

Posted at

zshでのasdfの補完設定

Catalinaにしてからshellがzshになり次のようなエラーが出るようになったので修正しました。

/usr/local/opt/asdf/etc/bash_completion.d/asdf.bash:68: command not found: complete

補完の設定

基本的には、 fpath を設定して autoload -Uz compinitcompinit を実行します。
asdfのinstall時に Homebrewを使った場合 と Gitを使った場合 で fpath の設定値が異なります。

Homebrewを使ってinstallした場合

fpath=(
  $(brew --prefix asdf)/etc/bash_completion.d
  $fpath
)
autoload -Uz compinit && compinit

Gitを使ってinstallした場合

ASDF_DIR はGitを使ってinstallしたときのasdfのディレクトリを設定してください。

fpath=(${ASDF_DIR}/completions $fpath)
autoload -Uz compinit && compinit

修正前

# asdf
. $(brew --prefix asdf)/asdf.sh
. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash

# enable the default zsh completions!
autoload -Uz compinit && compinit

参考サイト

https://asdf-vm.com/#/core-manage-asdf-vm?id=add-to-your-shell
https://github.com/asdf-vm/asdf/issues/68
https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?