clean PS1 building
This commit is contained in:
parent
2ac8de6f4b
commit
ee45f66c36
@ -369,7 +369,7 @@ __shorten_path()
|
|||||||
echo "${p:0:((${pos[${keep}]}+1))}${mask}${p:((len-max_len+mask_len))}"
|
echo "${p:0:((${pos[${keep}]}+1))}${mask}${p:((len-max_len+mask_len))}"
|
||||||
else
|
else
|
||||||
# constraints are satisfied, at least
|
# constraints are satisfied, at least
|
||||||
# some parts of the path, plus …, are
|
# some parts of the path, plus ' … ', are
|
||||||
# shorter than the maximum allowed size
|
# shorter than the maximum allowed size
|
||||||
#
|
#
|
||||||
echo "${p:0:((${pos[${keep}]}+1))}${mask}${p:pos[i]}"
|
echo "${p:0:((${pos[${keep}]}+1))}${mask}${p:pos[i]}"
|
||||||
@ -726,19 +726,24 @@ __set_bash_prompt()
|
|||||||
# end of the prompt line: double spaces
|
# end of the prompt line: double spaces
|
||||||
__MARK=$(__sb "$(__smart_mark)")
|
__MARK=$(__sb "$(__smart_mark)")
|
||||||
|
|
||||||
|
|
||||||
# add jobs, load and battery
|
# add jobs, load and battery
|
||||||
PS1="${__BATT}${__LOAD}${__JOBS}"
|
PS1="${__BATT}${__LOAD}${__JOBS}"
|
||||||
|
# add user, host and permissions colon
|
||||||
|
PS1="${PS1}[${__USER}${__HOST}${NO_COL}${__PERM}"
|
||||||
|
|
||||||
# if not root
|
# if not root
|
||||||
if [[ "$EUID" -ne "0" ]]
|
if [[ "$EUID" -ne "0" ]]
|
||||||
then
|
then
|
||||||
PS1="${PS1}[${__USER}${__HOST}${__PERM}${BOLD_FG}${__PWD}${NO_COL}]"
|
# path in foreground color
|
||||||
|
PS1="${PS1}${BOLD_FG}${__PWD}${NO_COL}]"
|
||||||
|
# add VCS infos
|
||||||
PS1="${PS1}${__GIT}${__HG}${__SVN}"
|
PS1="${PS1}${__GIT}${__HG}${__SVN}"
|
||||||
else
|
else
|
||||||
PS1="${PS1}[${__USER}${__HOST}${NO_COL}${__PERM}${YELLOW}${__PWD}${NO_COL}]"
|
# path in yellow
|
||||||
|
PS1="${PS1}${YELLOW}${__PWD}${NO_COL}]"
|
||||||
# do not add VCS infos
|
# do not add VCS infos
|
||||||
fi
|
fi
|
||||||
|
# add return code and prompt mark
|
||||||
PS1="${PS1}${PURPLE}${__RET}${NO_COL}${__MARK}"
|
PS1="${PS1}${PURPLE}${__RET}${NO_COL}${__MARK}"
|
||||||
|
|
||||||
# Glue the bash prompt always go to the first column.
|
# Glue the bash prompt always go to the first column.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user