]> git.r.bdr.sh - rbdr/dotfiles/commitdiff
Add asdf config
authorRuben Beltran del Rio <redacted>
Thu, 24 Jun 2021 13:32:23 +0000 (15:32 +0200)
committerRuben Beltran del Rio <redacted>
Thu, 24 Jun 2021 13:32:23 +0000 (15:32 +0200)
runcoms/zshrc
zsh/modules/prompt.zsh

index d59c6b9578bf3b0a46586af19db634cf07cb4fbb..9f53b8b898e6ffb4779ece352ac79e2763298b34 100644 (file)
@@ -45,7 +45,7 @@ export VISUAL="vim"
 export VIRTUAL_ENV_DISABLE_PROMPT=1
 export WORKON_HOME=$HOME/.virtualenvs
 export PROJECT_HOME=$HOME/Projects
-export VIRTUALENVWRAPPER_PYTHON="/usr/local/bin/python"
+export VIRTUALENVWRAPPER_PYTHON="/usr/local/bin/python3"
 
 # GPG
 export GPG_TTY=$(tty)
@@ -72,3 +72,6 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zshrc.local" ]]; then
 fi
 
 eval $(/usr/libexec/path_helper -s)
+
+# ASDF
+. $(brew --prefix asdf)/asdf.sh
index 482bfc780ceba396f66281251455f24b9ff07f5f..2b7454d140f3d43a0195f1193a2278947b420cf0 100644 (file)
@@ -16,31 +16,29 @@ function prompt_precmd {
 # Functions
 #
 
-function virtualenv_info {
+function env_info_provider() { echo "%{%F{green}%}n/a"; }
+function env_info {
+  echo "[%{%F{cyan}%}ENV%{%F{black}%} $(env_info_provider)%{%F{black}%}]"
+}
+
+function python_info {
+  pythoninfo=`asdf current python | sed 's/  */ /g' | cut -d ' ' -f 2`
   if [[ -z "$VIRTUAL_ENV" ]]; then
     venv="default"
   else
     venv="${VIRTUAL_ENV##*/}"
   fi
-  echo "%{%F{green}%}py%{%F{black}%} ${venv}"
+  echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo}@${venv}"
 }
 
-function rvm_info {
-  if [[ -z "$RUBY_VERSION" ]]; then
-    rvminfo="default"
-  else
-    rvminfo=`rvm-prompt`
-  fi
-  echo "%{%F{red}%}rb%{%F{black}%} ${rvminfo}"
+function ruby_info {
+  rubyinfo=`asdf current ruby | sed 's/  */ /g' | cut -d ' ' -f 2`
+  echo "%{%F{red}%}rb%{%F{black}%} ${rubyinfo}"
 }
 
-function nvm_info {
-  if [[ -z "$NVM_BIN" ]]; then
-    nvminfo="default"
-  else
-    nvminfo=`nvm current`
-  fi
-  echo "%{%F{yellow}%}js%{%F{black}%} ${nvminfo}"
+function node_info {
+  nodeinfo=`asdf current nodejs | sed 's/  */ /g' | cut -d ' ' -f 2`
+  echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo}"
 }
 
 function box_name {
@@ -102,7 +100,7 @@ function prompt_setup {
 
   # Define prompts.
   PROMPT='
-%{%F{black}%}$(nvm_info) $(rvm_info) $(virtualenv_info)
+%{%F{black}%}$(env_info) $(node_info) $(ruby_info) $(python_info)
 %{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(box_name)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}${git_info[prompt]} %{%f%}
 %(?,,%{${%B%F{white}%}[%?]%{%f%b%} )$ '
 }