diff --git a/prompt.bash b/prompt.bash index e0ae7ac..a98c900 100644 --- a/prompt.bash +++ b/prompt.bash @@ -131,9 +131,9 @@ __host_color() echo -ne "${ret}${NO_COL}" } -##################################### -# Count the number of attached jobs # -##################################### +################ +# Related jobs # +################ # Either attached running jobs (started with $ myjob &) # or attached stopped jobs (suspended with Ctrl-Z) @@ -155,6 +155,15 @@ __jobcount_color() echo -ne "$rep" } +# Display the return value of the last command, if different from zero +__return_value() +{ + if [ "$1" -ne "0" ] + then + echo -ne "$1" + fi +} + ###################### # VCS branch display # @@ -376,6 +385,11 @@ __load_color() fi } + +########## +# DESIGN # +########## + # Set the prompt mark to ± if VCS, # if root and else $ __smart_mark() { @@ -391,15 +405,6 @@ __smart_mark() fi } -# Display the return value of the last command, if different from zero -__return_value() -{ - if [ "$1" -ne "0" ] - then - echo -ne "$1" - fi -} - # space right __sr() { @@ -424,6 +429,11 @@ __sb() fi } + +######################## +# Construct the prompt # +######################## + __set_bash_prompt() { # left of main prompt @@ -456,9 +466,6 @@ __set_bash_prompt() # Avoid glitches after interrupting a command with Ctrl-C PS1="\[\033[G\]${PS1}${NO_COL}" } -######################## -# Construct the prompt # -######################## PROMPT_COMMAND=__set_bash_prompt