瀏覽代碼

Extended prompt to full terminal width. Cursor on second line

tags/original
Bryan Miller 6 年之前
父節點
當前提交
81c5fd227a
共有 1 個檔案被更改,包括 15 行新增2 行删除
  1. +15
    -2
      ps1.rc.sh

+ 15
- 2
ps1.rc.sh 查看文件

@@ -41,9 +41,17 @@ function section_separator() {
# $1 - Content
# $2 - Text (FG) color
# $3 - BG Color
# $4 - Font style
# $5 - Ignore section separator
function section(){
ignore=$5
if [ "$ignore" != true ]; then
ignore=false
fi
if [ "$last_section_bg" ]; then
section_separator ${2} ${3}
if [ "$ignore" = false ]; then
section_separator ${2} ${3}
fi
fi
last_section_bg=$3
PS1+="$(_CC ${2} ${3} ${4})${1}"
@@ -152,18 +160,23 @@ set_prompt() {
local color=$GREEN
local bg=$BG_LBLUE
local smilie=" ${symbols[smilie]} "
local DL="\033[1B"
local UL2="\033[1A"
if [ $COLOR_PROMPT = yes ]; then
if [ $lec -ne 0 ]; then
color=$RED
smilie=" ${symbols[frownie]} "
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} "
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 " \u@\h " $BLUE $BG_LCYAN
section " $(short_PWD $PWD 20) " $LCYAN $BG_BLUE
section_git_status $YELLOW $BG_LBLUE
section "\n" $DEFAULT $BG_GREY
section_separator
PS1+="> \033[K"
unset last_section_bg
else
PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\$ "

Loading…
取消
儲存