smart spacing management
This commit is contained in:
parent
50e083e42d
commit
3e1d262754
1 changed files with 64 additions and 33 deletions
49
prompt.bash
49
prompt.bash
|
|
@ -399,17 +399,48 @@ __return_value()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# space right
|
||||||
|
__sr()
|
||||||
|
{
|
||||||
|
if [ ! -z "$1" ] ; then
|
||||||
|
echo -n "$1<"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# space left
|
||||||
|
__sl()
|
||||||
|
{
|
||||||
|
if [ ! -z "$1" ] ; then
|
||||||
|
echo -n ">$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# space both
|
||||||
|
__sb()
|
||||||
|
{
|
||||||
|
if [ ! -z "$1" ] ; then
|
||||||
|
echo -n "=$1="
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
__set_bash_prompt()
|
__set_bash_prompt()
|
||||||
{
|
{
|
||||||
__RETURN="`__return_value $?`"
|
# left of main prompt
|
||||||
__LOAD="`__load_color`"
|
__JOBS=$(__sr "`__jobcount_color`")
|
||||||
__JOBS="`__jobcount_color`"
|
__LOAD=$(__sr "`__load_color`")
|
||||||
__BATT="`__battery_color`"
|
__BATT=$(__sr "`__battery_color`")
|
||||||
__GIT="`__git_branch_color`"
|
|
||||||
__HG="`__hg_branch_color`"
|
# in main prompt
|
||||||
__SVN="`__svn_branch_color`"
|
|
||||||
__HOST="`__host_color`"
|
__HOST="`__host_color`"
|
||||||
__PROMPT="`__smart_mark`"
|
|
||||||
|
# right of main prompt
|
||||||
|
__GIT=$(__sl "`__git_branch_color`")
|
||||||
|
__HG=$(__sl "`__hg_branch_color`")
|
||||||
|
__SVN=$(__sl "`__svn_branch_color`")
|
||||||
|
__RET=$(__sl "`__return_value $?`")
|
||||||
|
|
||||||
|
__MARK=$(__sb "`__smart_mark`")
|
||||||
|
|
||||||
PS1="${__BATT}${__LOAD}${__JOBS}"
|
PS1="${__BATT}${__LOAD}${__JOBS}"
|
||||||
if [ "$EUID" -ne "0" ]
|
if [ "$EUID" -ne "0" ]
|
||||||
then
|
then
|
||||||
|
|
@ -418,7 +449,7 @@ __set_bash_prompt()
|
||||||
else
|
else
|
||||||
PS1="${PS1}[${LIGHT_YELLOW}\u${__HOST}${NO_COL}:${YELLOW}\w${NO_COL}]"
|
PS1="${PS1}[${LIGHT_YELLOW}\u${__HOST}${NO_COL}:${YELLOW}\w${NO_COL}]"
|
||||||
fi
|
fi
|
||||||
PS1="${PS1}${__RETURN}${__PROMPT} "
|
PS1="${PS1}${__RET}${__MARK}"
|
||||||
|
|
||||||
# Glue the bash prompt always go to the first column .
|
# Glue the bash prompt always go to the first column .
|
||||||
# Avoid glitches after interrupting a command with Ctrl-C
|
# Avoid glitches after interrupting a command with Ctrl-C
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue