|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
short_PWD () |
|
|
|
|
|
{ |
|
|
|
|
|
local PRE= NAME="$1" LENGTH="$2"; |
|
|
|
|
|
[[ "$NAME" != "${NAME#$HOME/}" || -z "${NAME#$HOME}" ]] && |
|
|
|
|
|
PRE+='~' NAME="${NAME#$HOME}" LENGTH=$[LENGTH-1]; |
|
|
|
|
|
((${#NAME}>$LENGTH)) && NAME="/...${NAME:$[${#NAME}-LENGTH+4]}"; |
|
|
|
|
|
echo "$PRE$NAME" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
# NOTE: Removed this as it does not handle paths with spaces well. |
|
|
|
|
|
#short_PWD () |
|
|
|
|
|
#{ |
|
|
|
|
|
# local PRE= NAME="$1" LENGTH="$2"; |
|
|
|
|
|
# [[ "$NAME" != "${NAME#$HOME/}" || -z "${NAME#$HOME}" ]] && |
|
|
|
|
|
# PRE+='~' NAME="${NAME#$HOME}" LENGTH=$[LENGTH-1]; |
|
|
|
|
|
# ((${#NAME}>$LENGTH)) && NAME="/...${NAME:$[${#NAME}-LENGTH+4]}"; |
|
|
|
|
|
# echo "$PRE$NAME" |
|
|
|
|
|
#} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_prompt() { |
|
|
set_prompt() { |
|
|
local lec="$?" |
|
|
local lec="$?" |
|
|
|
|
|
if [ -z "$PROMPT_DIRTRIM" ]; then |
|
|
|
|
|
PROMPT_DIRTRIM=2 |
|
|
|
|
|
fi |
|
|
local color=$GREEN |
|
|
local color=$GREEN |
|
|
local bg=$BG_LBLUE |
|
|
local bg=$BG_LBLUE |
|
|
local smilie=" ${symbols[smilie]} " |
|
|
local smilie=" ${symbols[smilie]} " |
|
|
|
|
|
|
|
|
section $smilie $color $BG_BLACK 1 true |
|
|
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 " \w " $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 "\n" $DEFAULT $BG_GREY |
|
|
section_separator |
|
|
section_separator |