summaryrefslogtreecommitdiff
path: root/plugins/asdf
diff options
context:
space:
mode:
authorCarlo Sala <carlosalag@protonmail.com>2025-02-12 20:15:25 +0100
committerCarlo Sala <carlosalag@protonmail.com>2025-02-12 20:15:25 +0100
commit4d9d346718caa6efdf6f350ed803e70d34fc6577 (patch)
tree7760692a65fa570e6e5efdcec993d0a00159c788 /plugins/asdf
parentdb32c6ccce91e0b36873c8bfccd1e40f452a2060 (diff)
downloadzsh-4d9d346718caa6efdf6f350ed803e70d34fc6577.tar.gz
zsh-4d9d346718caa6efdf6f350ed803e70d34fc6577.tar.bz2
zsh-4d9d346718caa6efdf6f350ed803e70d34fc6577.zip
feat(asdf): support asdf v0.16 ahead
Co-authored-by: Valgard Trontheim <github@trontheim.de> Closes #12964 Closes #12967
Diffstat (limited to 'plugins/asdf')
-rw-r--r--plugins/asdf/asdf.plugin.zsh18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh
index 7635d20c3..4367e8ca3 100644
--- a/plugins/asdf/asdf.plugin.zsh
+++ b/plugins/asdf/asdf.plugin.zsh
@@ -1,3 +1,21 @@
+if (( $+commands[asdf] )); then
+ export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
+ path=("$ASDF_DATA_DIR/shims" $path)
+
+ # If the completion file doesn't exist yet, we need to autoload it and
+ # bind it to `asdf`. Otherwise, compinit will have already done that.
+ if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _asdf
+ _comps[asdf]=_asdf
+ fi
+ asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|
+
+ return
+fi
+
+# TODO:(2025-02-12): remove deprecated asdf <0.16 code
+
# Find where asdf should be installed
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions"