From f2daf2ccc656d1dd0ac58985be56d38a840532b2 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Sat, 11 Nov 2023 18:01:09 +0800 Subject: [PATCH] move the examples around should probably all be consolidated in readme --- bash-color-prompt.sh | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/bash-color-prompt.sh b/bash-color-prompt.sh index 3594931..145eef6 100644 --- a/bash-color-prompt.sh +++ b/bash-color-prompt.sh @@ -1,21 +1,25 @@ -## to truncate \w dirpath set: -# PROMPT_DIRTRIM=4 +# see also /usr/share/doc/bash-color-prompt/README.md + +# example colorings: +# PROMPT_COLOR=0 # disable colors/attribs +# PROMPT_COLOR=1 # bold prompt +# PROMPT_COLOR=2 # dim prompt +# PROMPT_COLOR=4 # underline prompt +# PROMPT_COLOR='2;7' # dim reverse video +# PROMPT_COLOR='42' # green background +# PROMPT_COLOR='53' # overline separator +# PROMPT_COLOR='1;33;44' # bold yellow on blue +# PROMPT_COLOR='43;30' # black on yellow +# PROMPT_COLOR='1;32' # bold green +# PROMPT_COLOR='' # unset defaults to green # See for ANSI codes +## to truncate \w dirpath set: +# PROMPT_DIRTRIM=3 + # only set for color terminals and if PS1 unchanged from bash or fedora defaults if [ '(' "$PS1" = "[\u@\h \W]\\$ " -o "$PS1" = "\\s-\\v\\\$ " ')' -a "${TERM: -5}" = "color" -o -n "${prompt_color_force}" ]; then - # examples: - # PROMPT_COLOR=0 # disable colors/attribs - # PROMPT_COLOR=1 # bold prompt - # PROMPT_COLOR=2 # dim prompt - # PROMPT_COLOR=4 # underline prompt - # PROMPT_COLOR='2;7' # dim reverse video - # PROMPT_COLOR='42' # green background - # PROMPT_COLOR='53' # overline separator - # PROMPT_COLOR='1;33;44' # bold yellow on blue - # PROMPT_COLOR='1;32' # bold green - # PROMPT_COLOR='' # unset defaults to green PS1='${PROMPT_BRACKETS:+[}\[\e[${PROMPT_COLOR:-32}m\]${container:+⬢ }\u@\h\[\e[0m\]:\[\e[${PROMPT_DIR_COLOR:-${PROMPT_COLOR:-32}}m\]\w${PROMPT_ERROR:+\[\e[0;31m\]${?#0}}\[\e[0m\]${PROMPT_BRACKETS:+]}\$ '