|
|
@@ -1,16 +1,39 @@ |
|
|
|
|
|
|
|
# define symbols |
|
|
|
declare -A symbols=( |
|
|
|
[hard_separator]="▶" |
|
|
|
[soft_separator]="|" |
|
|
|
[git]="" |
|
|
|
[lock]="" |
|
|
|
[flag]="⚑" |
|
|
|
[plus]="✚" |
|
|
|
[tick]="✔" |
|
|
|
[cross]="✘" |
|
|
|
[enter]="⏎" |
|
|
|
[python]="λ" |
|
|
|
[battery_charging]="⚡" |
|
|
|
[battery_discharging]="▮" |
|
|
|
[untracked]="U" |
|
|
|
[stash]="🐿" |
|
|
|
[ahead]="+" |
|
|
|
[behind]="-" |
|
|
|
[smilie]="☺" |
|
|
|
[frownie]="☹" |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# This function was modified from one found @ https://www.reddit.com/r/linux/comments/2uf5uu/this_is_my_bash_prompt_which_is_your_favorite/?st=jikgswh4&sh=371ba8bf |
|
|
|
function _git_status() { |
|
|
|
local unknown untracked stash clean ahead behind staged dirty diverged |
|
|
|
unknown=$BLUE |
|
|
|
untracked=$GREEN |
|
|
|
stash=$GREEN |
|
|
|
clean=$GREEN |
|
|
|
ahead=$YELLOW |
|
|
|
behind=$YELLOW |
|
|
|
staged=$CYAN |
|
|
|
dirty=$RED |
|
|
|
diverged=$RED |
|
|
|
unknown=$(_CC $BLUE $BG_DGREY) |
|
|
|
untracked=$(_CC $GREEN $BG_DGREY) |
|
|
|
stash=$(_CC $GREEN $BG_DGREY) |
|
|
|
clean=$(_CC $GREEN $BG_DGREY) |
|
|
|
ahead=$(_CC $YELLOW $BG_DGREY) |
|
|
|
behind=$(_CC $YELLOW $BG_DGREY) |
|
|
|
staged=$(_CC $CYAN $BG_DGREY) |
|
|
|
dirty=$(_CC $RED $BG_DGREY) |
|
|
|
diverged=$(_CC $RED $BG_DGREY) |
|
|
|
|
|
|
|
|
|
|
|
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) |
|
|
@@ -49,7 +72,7 @@ function _git_status() { |
|
|
|
color=$diverged |
|
|
|
branch="${branch}!" |
|
|
|
fi |
|
|
|
echo -n "${color}${branch}${NORMAL}|" |
|
|
|
echo -n "${color}${symbols[git]}${branch}" |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
@@ -58,11 +81,11 @@ set_prompt() { |
|
|
|
local lec="$?" |
|
|
|
if [ $COLOR_PROMPT = yes ]; then |
|
|
|
if [ $lec -ne 0 ]; then |
|
|
|
smilie="${RED}:(${NORMAL}" |
|
|
|
smilie="$(_CC $RED $BG_DGREY)${symbols[frownie]}" |
|
|
|
else |
|
|
|
smilie="${GREEN}:)${NORMAL}" |
|
|
|
smilie="$(_CC $GREEN $BG_DGREY)${symbols[smilie]}" |
|
|
|
fi |
|
|
|
PS1="${debian_chroot:+($debian_chroot)}${BG_PURPLE}${GREEN}\u${NORMAL}${BG_PURPLE}|${BLUE}\w${NORMAL}${BG_PURPLE}|${smilie}${BG_PURPLE}|$(_git_status)${PURPLE}► " |
|
|
|
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} " |
|
|
|
else |
|
|
|
PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\$ " |
|
|
|
fi |