summaryrefslogtreecommitdiff
path: root/bash/prompt
blob: 09a75c74dcbbcc98da01277d3719dc5504651c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
[ -r /usr/lib/git-core/git-sh-prompt ] && . /usr/lib/git-core/git-sh-prompt

# define a fallback for __git_ps1 if git is not installed
if [ "x$(type -t __git_ps1)" != "xfunction" ]; then
   __git_ps1() {
       echo ""
   }
fi

GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUPSTREAM="auto"

__prompt_func() {
    ################################################
    # THERE SHOULD BE NO NEED TO EDIT THIS SECTION #
    ################################################

    #$normal will reset the colour to the default, use it to stop using a certain colour (see "prompt parts")
    local normal="\[\e[0m\]"

    # # # # # # #
    #BACKGROUNDS
    # # # # # # #
    local blackbg=";40m\]"
    local redbg=";41m\]"
    local greenbg=";42m\]"
    local brownbg=";43m\]"
    local bluebg=";44m\]"
    local purplebg=";45m\]"
    local cyanbg=";46m\]"
    local greybg=";47m\]"

    ############################################################################################
    # THERE SHOULD BE NO NEED TO EDIT THIS SECTION (UNLESS YOU DO NOT WANT A BLACK BACKGROUND) #
    ############################################################################################
    # # # # # # #
    #FOREGROUNDS
    # # # # # # #
    local black="\[\e[0;30$blackbg"
    local redfaint="\[\e[0;31$blackbg"
    local greenfaint="\[\e[0;32$blackbg"
    local brownfaint="\[\e[0;33$blackbg"
    local bluefaint="\[\e[0;34$blackbg"
    local purplefaint="\[\e[0;35$blackbg"
    local cyanfaint="\[\e[0;36$blackbg"
    local greyfaint="\[\e[0;37$blackbg"

    local grey="\[\e[1;30$blackbg"
    local red="\[\e[1;31$blackbg"
    local green="\[\e[1;32$blackbg"
    local yellow="\[\e[1;33$blackbg"
    local blue="\[\e[1;34$blackbg"
    local pink="\[\e[1;35$blackbg"
    local cyan="\[\e[1;36$blackbg"
    local white="\[\e[1;37$blackbg"

    ##################################
    # EDIT THIS STUFF TO YOUR LIKING #
    ##################################
    # # # # # # #
    #PROMPT PARTS
    # # # # # # #
    local prompt_opening_brace="$cyan[$normal"
    local prompt_closing_brace="$cyan]$normal"

    local prompt_date="\d"
    local prompt_hostname_short="$blue\h$normal"
    local prompt_hostname_long="\H"
    local prompt_jobs="\j"
    local prompt_terminal="\l"
    local prompt_shellname="\s"
    local prompt_time_24="\t"
    local prompt_time_12="\T"
    local prompt_time_12_am_pm="\@"
    local prompt_username="$greenfaint\u$normal"
    local prompt_version="\v"
    local prompt_version_patchlevel="\V"
    local prompt_pwd_long="$cyanfaint\w$normal"
    local prompt_pwd_short="$red\W$normal"
    local prompt_history_number="\!"
    local prompt_session_number="\#"
    local prompt_usertype_sign="\\$"
    local prompt_git_branch="$white\$(__git_ps1)$normal"

    local dotfiles_dirty="$red\$([ -f ~/.local/var/dotfiles/dirty ] && echo -n \\\!\ )$normal"

    # # # # # # # #
    #FINAL PROMPT
    # # # # # # # #
    echo -n "$prompt_opening_brace $dotfiles_dirty$prompt_username@$prompt_hostname_short $prompt_pwd_long$prompt_git_branch$prompt_closing_brace$prompt_usertype_sign "
}