}
{% set ps1_git = '\[$(git_prompt_color)\]$(git_prompt)' %}
-function error_code() {
- ret=$?
- if [[ $ret != 0 ]]; then
- echo "$ret "
- fi
-}
-
function running_jobs() {
ret=$(jobs | wc -l)
if [[ $ret != 0 ]]; then
echo "[$ret] "
fi
}
-{% set ps1_status = '\[\\033[01;31m\]$(error_code)\[\\033[00;00m\]$(running_jobs)' -%}
-
-{# Ensure new line before the prompt #}
-{% set ps1_newline = '$(printf "%$((`tput cols`-1))s\\r")' -%}
-{% set ps1_other = '' %}
-{% if role.get(profile) == "fretlink" -%}
- {% set ps1_other = '\[\\033[01;32m\]$(dev_prompt)' %}
-{%- endif %}
+PROMPT_COMMAND=__prompt_command
-PS1='{{ ps1_newline }}{{ ps1_status }}{{ ps1_other }}{{ ps1_git }}\[\033[00;32m\]\u@\h\[\033[94m\] \w \$\[\033[00m\] '
+__prompt_command () {
+ local ret="$?"
+ PS1=""
+ d="\[\033[00;00m\]"
+ red="\[\033[01;31m\]"
+ bgreen="\[\033[01;32m\]"
+ green="\[\033[00;32m\]"
+ blue="\[\033[94m\]"
-PROMPT_COMMAND="[[ -f $XDG_STATE_HOME/bash/bashrc_temp ]] && . $XDG_STATE_HOME/bash/bashrc_temp"
+ # Ensure new line before the prompt
+ PS1='$(printf "%$((`tput cols`-1))s\r")'
+ if [[ $ret != 0 ]]; then
+ PS1+="$red$ret $d"
+ fi
+ PS1+='$(running_jobs)'
+{% if role.get(profile) == "fretlink" %}
+ PS1+="$bgreen"'$(dev_prompt)'
+{% endif %}
+ PS1+='\[$(git_prompt_color)\]$(git_prompt)'
+ PS1+="$green\u@\h$blue \w \$$d "
+}
{% if "nodejs" in features.get(profile, []) %}
source /usr/share/nvm/init-nvm.sh