diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2017-03-07 19:01:17 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2017-03-07 19:20:46 +0100 |
| commit | 5668418df04777110154c9a257c59d656d881924 (patch) | |
| tree | 79f72c393d90cccda16aed9214958a781e64a18e /.bash_prompt | |
| parent | 506a4a058d9cc182ad45e34e5892aeda3c0baeaf (diff) | |
| download | dotfiles-5668418df04777110154c9a257c59d656d881924.tar.xz | |
(m) Simplify code and tweak whitespace
Diffstat (limited to '.bash_prompt')
| -rw-r--r-- | .bash_prompt | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/.bash_prompt b/.bash_prompt index 59cf090..e2dfbab 100644 --- 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 |
