Browse Source

Extended prompt to full terminal width. Cursor on second line

tags/original
Bryan Miller 6 years ago
parent
commit
81c5fd227a
1 changed files with 15 additions and 2 deletions
  1. +15
    -2
      ps1.rc.sh

+ 15
- 2
ps1.rc.sh View File

# $1 - Content # $1 - Content
# $2 - Text (FG) color # $2 - Text (FG) color
# $3 - BG Color # $3 - BG Color
# $4 - Font style
# $5 - Ignore section separator
function section(){ function section(){
ignore=$5
if [ "$ignore" != true ]; then
ignore=false
fi
if [ "$last_section_bg" ]; then if [ "$last_section_bg" ]; then
section_separator ${2} ${3}
if [ "$ignore" = false ]; then
section_separator ${2} ${3}
fi
fi fi
last_section_bg=$3 last_section_bg=$3
PS1+="$(_CC ${2} ${3} ${4})${1}" PS1+="$(_CC ${2} ${3} ${4})${1}"
local color=$GREEN local color=$GREEN
local bg=$BG_LBLUE local bg=$BG_LBLUE
local smilie=" ${symbols[smilie]} " local smilie=" ${symbols[smilie]} "
local DL="\033[1B"
local UL2="\033[1A"
if [ $COLOR_PROMPT = yes ]; then if [ $COLOR_PROMPT = yes ]; then
if [ $lec -ne 0 ]; then if [ $lec -ne 0 ]; then
color=$RED color=$RED
smilie=" ${symbols[frownie]} " smilie=" ${symbols[frownie]} "
fi fi
PS1="${debian_chroot:+($debian_chroot)}" #$(_CC $GREEN $BG_DGREY)\u $(_CC $LBLUE $BG_DGREY)\w$(_CC $DEFAULT $BG_DGREY)|${smilie}$(_CC $DEFAULT $BG_DGREY)|$(_git_status)${NORMAL}$(_CFG $DGREY)${symbols[hard_separator]}${NORMAL} " PS1="${debian_chroot:+($debian_chroot)}" #$(_CC $GREEN $BG_DGREY)\u $(_CC $LBLUE $BG_DGREY)\w$(_CC $DEFAULT $BG_DGREY)|${smilie}$(_CC $DEFAULT $BG_DGREY)|$(_git_status)${NORMAL}$(_CFG $DGREY)${symbols[hard_separator]}${NORMAL} "
section $smilie $color $BG_BLACK 1
section "\n\033[1A$(printf "%*s" $(($(tput cols)-2)) "") \r" $BLUE $BG_GREY
section $smilie $color $BG_BLACK 1 true
section_tty $BLACK $BG_LBLUE $RED $BG_YELLOW section_tty $BLACK $BG_LBLUE $RED $BG_YELLOW
section " \u@\h " $BLUE $BG_LCYAN section " \u@\h " $BLUE $BG_LCYAN
section " $(short_PWD $PWD 20) " $LCYAN $BG_BLUE section " $(short_PWD $PWD 20) " $LCYAN $BG_BLUE
section_git_status $YELLOW $BG_LBLUE section_git_status $YELLOW $BG_LBLUE
section "\n" $DEFAULT $BG_GREY
section_separator section_separator
PS1+="> \033[K"
unset last_section_bg unset last_section_bg
else else
PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\$ " PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\$ "

Loading…
Cancel
Save