mise.plugin.zsh 667 B

1234567891011121314151617181920212223242526
  1. # TODO: 2024-01-03 remove rtx support
  2. local __mise=mise
  3. if (( ! $+commands[mise] )); then
  4. if (( $+commands[rtx] )); then
  5. __mise=rtx
  6. else
  7. return
  8. fi
  9. fi
  10. # Load mise hooks
  11. eval "$($__mise activate zsh)"
  12. # Hook mise into current environment
  13. eval "$($__mise hook-env -s zsh)"
  14. # If the completion file doesn't exist yet, we need to autoload it and
  15. # bind it to `mise`. Otherwise, compinit will have already done that.
  16. if [[ ! -f "$ZSH_CACHE_DIR/completions/_$__mise" ]]; then
  17. typeset -g -A _comps
  18. autoload -Uz _$__mise
  19. _comps[$__mise]=_$__mise
  20. fi
  21. # Generate and load mise completion
  22. $__mise completion zsh >| "$ZSH_CACHE_DIR/completions/_$__mise" &|