diff options
author | balou <balou@tilde.institute> | 2022-08-04 19:07:02 +0000 |
---|---|---|
committer | balou <balou@tilde.institute> | 2022-08-04 19:07:02 +0000 |
commit | fe30283cd6dfcac70df90e3939693d7ad37d1751 (patch) | |
tree | 14fd3b743d7744065d8d1219afa54d130c82f5b8 | |
parent | 91b34a0077e57be5c46637f12d441d40ada2673e (diff) | |
download | portable-prompt-fe30283cd6dfcac70df90e3939693d7ad37d1751.tar.gz |
newest version
-rw-r--r-- | portable-prompt.sh | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/portable-prompt.sh b/portable-prompt.sh index bcc2385..1ea948b 100644 --- a/portable-prompt.sh +++ b/portable-prompt.sh @@ -49,7 +49,7 @@ prompt_helper(){ if [ "$SERIAL" ]; then local rows local cols - IFS='[;' read -p $'\033\033[r\033[999;999H\033[6n\033' -d R -s _ rows cols + IFS='[;' read -rp $'\033\033[r\033[999;999H\033[6n\033' -d R -s _ rows cols if [ "x$rows $cols" != "x$LINES $COLUMNS" ]; then stty rows "$rows" cols "$cols" fi @@ -88,7 +88,7 @@ pretty_title(){ local pwd case $PWD in $HOME*) - pwd="~${PWD#$HOME}" + pwd="~${PWD#"$HOME"}" ;; *) pwd=$PWD @@ -211,7 +211,8 @@ set -o emacs #alias ls='ls -F --color=auto' alias ls='ls -F' alias sc='du -schx -- *|sort -h' -alias vi='vim "+sy on" "+colo elflord" "+se nu" "+se ai" "+se si" "+se hls"' +#alias vi='vim "+sy on" "+colo elflord" "+se nu" "+se ai" "+se si" "+se hls"' +alias vi='vim "+sy on" "+colo elflord" "+se nu ai si hls"' : "${EUID:=$(id -u)}" CSI=$(printf '\033[') @@ -233,9 +234,13 @@ BLUE="${SC}1;34$EC" DBLUE="${SC}34$EC" STD="${SC}$EC" -STD="${SC}0;41$EC" -PREFIX=$STD -printf '%s' "$STD${CSI}J" +BGCOLOR="48;5;52" +BGCOLOR="" +if [ -n "$BGCOLOR" ]; then + STD="${SC}0;$BGCOLOR$EC" + PREFIX="$STD$PREFIX" + printf '%s' "$STD${CSI}J" +fi : "${HOSTNAME:=$(hostname)}" DISPLAYHOST=${HOSTNAME%%.*} @@ -257,7 +262,7 @@ dumb) ;; *) RPROMPT= - RPROMPT="$(basename $SHELL)" + RPROMPT="$(basename "$SHELL")" PS1="$PREFIX${UCOLOR}${DISPLAYHOST}${STD}.${BLUE}$START\$(prompt_helper;printf %s \"\$PWEXT\$RET\")$END${STD}$SYMBOL " #PS1="$PREFIX${UCOLOR}${DISPLAYHOST}${STD}.${BLUE}\$(prompt_helper)\$PWEXT\$RET${STD}$SYMBOL " ;; |