X-Git-Url: https://git.r.bdr.sh/rbdr/dotfiles/blobdiff_plain/3cfb240230ff88aa9a222a12926bd475d4e9eebf..19afe8a8f6903095255f5955796653690f9ffc88:/zsh/modules/prompt.zsh?ds=inline diff --git a/zsh/modules/prompt.zsh b/zsh/modules/prompt.zsh index a305178..beeb85d 100644 --- a/zsh/modules/prompt.zsh +++ b/zsh/modules/prompt.zsh @@ -1,5 +1,13 @@ autoload -Uz promptinit && promptinit +function tool_versions() { + if [[ -s ".tool-versions" ]]; then + echo '.tool-versions' + return + fi + echo "${HOME}/.tool-versions" +} + if [[ "$TERM" == (dumb|linux|*bsd*) ]] || (( $#prompt_argv < 1 )); then prompt 'off' fi @@ -22,18 +30,21 @@ function env_info { } function python_info { - pythoninfo=`cat ~/.tool-versions | rg python | cut -d ' ' -f 2` + pythoninfo=`cat "$(tool_versions)" | rg python | cut -d ' ' -f 2` + pythoninfo=${ASDF_PYTHON_VERSION:-$pythoninfo} venv="${VIRTUAL_ENV##*/}" echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo:-no}@${venv:-default}" } function ruby_info { - rubyinfo=`cat ~/.tool-versions | rg ruby | cut -d ' ' -f 2` + rubyinfo=`cat "$(tool_versions)" | rg ruby | cut -d ' ' -f 2` + rubyinfo=${ASDF_RUBY_VERSION:-$rubyinfo} echo "%{%F{red}%}rb%{%F{black}%} ${rubyinfo:-no}" } function node_info { - nodeinfo=`cat ~/.tool-versions | rg nodejs | cut -d ' ' -f 2` + nodeinfo=`cat "$(tool_versions)" | rg nodejs | cut -d ' ' -f 2` + nodeinfo=${ASDF_NODEJS_VERSION:-$nodeinfo} echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo:-no}" }