dotfiles

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

commit b15a51d3f2be594f648baf62aeda0c442cdd1784
parent 22e0f29bfa01b14780050f23612107d6f4350f76
Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Sat,  4 Oct 2025 17:52:34 +0200

"Namespace" PS1 functions for less-than-dumb terminals

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

diff --git a/.bash_prompt b/.bash_prompt @@ -118,15 +118,6 @@ __fontify () __end-nonprinting } -__set-prompt () -{ - BUILDING_PS=t - - PS1="$(__write-context)\n$(__fontify '\$' dim) " - - unset BUILDING_PS -} - __current-column () { # Cf. console_codes(4) Β§ ECMA-48 Status Report Commands @@ -185,7 +176,16 @@ __write-context () fi } -__refresh-terminal () +__smart-term/set-ps1 () +{ + BUILDING_PS=t + + PS1="$(__write-context)\n$(__fontify '\$' dim) " + + unset BUILDING_PS +} + +__smart-term/refresh () { local last_status=$? @@ -204,10 +204,10 @@ __refresh-terminal () __draw-rule dim fi - __set-prompt + __smart-term/set-ps1 } -__init-smart () +__smart-term/init () { ### Prompts. @@ -220,7 +220,7 @@ __init-smart () PS1_SHOWGITSTATUS=t fi - PROMPT_COMMAND=__refresh-terminal + PROMPT_COMMAND=__smart-term/refresh PS2=$( BUILDING_PS=t @@ -244,5 +244,5 @@ then PS1='$? \u:\w\$ ' PS2='> ' else - __init-smart + __smart-term/init fi