dotfiles

🎜 Clone'em, tweak'em, stick'em in your $HOME 🎝
git clone https://git.kevinlegouguec.net/dotfiles
Log | Files | Refs | README

commit 5668418df04777110154c9a257c59d656d881924
parent 506a4a058d9cc182ad45e34e5892aeda3c0baeaf
Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Tue,  7 Mar 2017 19:01:17 +0100

(m) Simplify code and tweak whitespace

Diffstat:
M.bash_prompt | 28+++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/.bash_prompt b/.bash_prompt @@ -89,6 +89,7 @@ __fontify () shift __start-nonprinting + echo -en '\E[' for ((i=1; i<=$#; i++)) @@ -106,6 +107,7 @@ __fontify () __end-nonprinting echo -en "${text}" + __start-nonprinting echo -en '\E[0m' __end-nonprinting @@ -114,11 +116,8 @@ __fontify () __set-prompt () { BUILDING_PS1=t - PS1='' - PS1+="$(__write-context)\n" - PS1+=$(__fontify '\$' dim) - PS1+=' ' + PS1="$(__write-context)\n$(__fontify '\$' dim) " unset BUILDING_PS1 } @@ -147,7 +146,7 @@ __signal-no-newline () __draw-rule () { - local line='' + local line for ((i=$(__current-column); i<COLUMNS; i++)) do @@ -163,35 +162,30 @@ __draw-rule () __write-context () { - local context='' - - context+=$(__fontify '\u' green) + __fontify '\u' green if __show-hostname then - context+=$(__fontify @ dim) - context+=$(__fontify '\h' bold green) + __fontify @ dim + __fontify '\h' bold green fi - context+=$(__fontify : dim) - context+=$(__fontify '\w' bold blue) + __fontify : dim + __fontify '\w' bold blue if [ ${PS1_SHOWGITSTATUS} ] then - context+=$(__fontify "$(__git_ps1 '(%s)')" red) + __fontify "$(__git_ps1 '(%s)')" red fi - - echo ${context} } __refresh-terminal () { local last_status=$? - local last_column=$(__current-column) __set-title - if [ ${last_column} -ne 1 ] + if [ $(__current-column) -ne 1 ] then __signal-no-newline fi