]> git.r.bdr.sh - rbdr/dotfiles/blobdiff - zsh/modules/prompt.zsh
Add asdf config
[rbdr/dotfiles] / zsh / modules / prompt.zsh
index b21a41f8c963c620dcea4a3c4f20760071947401..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 "🐍 ${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 "💎 ${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 "💛 ${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 {
@@ -56,13 +54,9 @@ function zle-line-init zle-keymap-select {
     # Couldn't figure out how to get tmux and iTerm to agree on how to render
     # these characters... so there you go.
 
-    local normal_symbol="🅽"
-    local insert_symbol="🅸"
-    local error_symbol="🆇"
-
-    [ ! -z "$TMUX" ] && normal_symbol="%{$normal_symbol%2G%}"
-    [ ! -z "$TMUX" ] && insert_symbol="%{$insert_symbol%2G%}"
-    [ ! -z "$TMUX" ] && error_symbol="%{$error_symbol%2G%}"
+    local normal_symbol="N"
+    local insert_symbol="I"
+    local error_symbol="X"
 
     # Show vi status / return status on the right side
 
@@ -106,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%} )$ '
 }