fix: rework error code writing / simplify it
This commit is contained in:
8
.bashrc
8
.bashrc
@@ -51,15 +51,15 @@ __regenprompt() {
|
||||
local git=$(__lazy_git_ps1)
|
||||
|
||||
if [ $err -ne 0 ]; then
|
||||
err="\033[s\033[$((COLUMNS - 4))G${err}\033[u"
|
||||
err="\[\033[$((COLUMNS - 4))G\033[01;31m\]${err}\[\033[0G\]"
|
||||
else unset err; fi
|
||||
|
||||
PS1="\[\033[?25h\]" # show cursor
|
||||
PS1="$err" # error code
|
||||
PS1="$PS1\[\033[?25h\]" # show cursor
|
||||
PS1="$PS1\[\033[01;35m\]\u@\h" # user@host
|
||||
PS1="$PS1\[\033[00m\]:" # separator
|
||||
PS1="$PS1\[\033[01;34m\]\w" # working directory
|
||||
PS1="$PS1\[\033[01;93m\]$git" # git branch
|
||||
PS1="$PS1\[\033[01;31m\]\[$err\]" # error code
|
||||
PS1="$PS1\[\033[01;93m\]${git}" # git branch
|
||||
PS1="$PS1\[\033[00m\]\$ " # shell sign
|
||||
}
|
||||
PROMPT_COMMAND=__regenprompt
|
||||
|
||||
Reference in New Issue
Block a user