all repos — dotfiles @ d41acc1737de46361a9fc8b8cb79e541189d736f

my *nix dotfiles

bash/.bashrc.d/99-prompt.bash (view raw)

 1# red="\e[31m"
 2# grn="\e[32m"
 3# ylw="\e[33m"
 4# cyn="\e[36m"
 5# blu="\e[34m"
 6# prp="\e[35m"
 7# bprp="\e[35;1m"
 8# gry="\e[94m"
 9# rst="\e[0m"
10# 
11# git_branch() {
12#     [[ -d "$PWD/.git" ]] && {
13#         local git_status="$(git status 2> /dev/null)"
14#         local on_branch="On branch ([^${IFS}]*)"
15#         local on_commit="HEAD detached at ([^${IFS}]*)"
16#         status="$(git status --porcelain 2> /dev/null)"
17#         local exit="$?"
18#         color=""
19# 
20#         if [[ "$exit" -eq 0 ]]; then
21#             if [[ "${#status}" -eq 0 ]]; then
22#                color="${grn}"
23#             else
24#                 color="${red}"
25#             fi
26#         else
27#             printf ''
28#         fi
29# 
30# 
31#         if [[ $git_status =~ $on_branch ]]; then
32#             local branch=${BASH_REMATCH[1]}
33#             printf '%b'  "($color$branch$rst)"
34#         elif [[ $git_status =~ $on_commit ]]; then
35#             local commit=${BASH_REMATCH[1]}
36#             printf '%b' "($color$commit$rst)"
37#         fi
38# 
39#     }
40# }
41# 
42# prompt_pwd() {
43#     printf '%b' "\001${cyn}\002$(dirs +0)\001${rst}\002"
44# }
45# 
46# rootornot() {
47#     [[ "$(id -u)" -eq 0 ]] &&
48#         printf '%b' "\001${red}\002#\001${rst}\002"
49# }
50
51PS1='$(prompt) '
52PS2="> "