diff options
Diffstat (limited to 'bash/prompt.bash')
-rw-r--r-- | bash/prompt.bash | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/bash/prompt.bash b/bash/prompt.bash index 02d9c98..f1bdd69 100644 --- a/bash/prompt.bash +++ b/bash/prompt.bash | |||
@@ -4,7 +4,7 @@ PS1= | |||
4 | 4 | ||
5 | # user, host, and cwd | 5 | # user, host, and cwd |
6 | PROMPT_DIRTRIM=3 # how many dirs above current to print (rest are '...') | 6 | PROMPT_DIRTRIM=3 # how many dirs above current to print (rest are '...') |
7 | PS1+='\[\e[34m\]# \u@\h \w' | 7 | PS1+='\[\e[0;46m\]\u@\h \w' |
8 | 8 | ||
9 | # git bit | 9 | # git bit |
10 | # see https://unix.stackexchange.com/questions/278206 | 10 | # see https://unix.stackexchange.com/questions/278206 |
@@ -16,13 +16,11 @@ possible_git_prompt_locations=( | |||
16 | ) | 16 | ) |
17 | 17 | ||
18 | for file in "${possible_git_prompt_locations[@]}"; do | 18 | for file in "${possible_git_prompt_locations[@]}"; do |
19 | if [[ -f "$file" ]]; then | 19 | if [[ -f "$file" ]]; then |
20 | source "$file" && | 20 | source "$file" && |
21 | PS1+='\[\e[35m\]$(__git_ps1)' | 21 | PS1+='\[\e[35m\]$(__git_ps1)' |
22 | break | 22 | break |
23 | else | 23 | fi |
24 | true | ||
25 | fi | ||
26 | done | 24 | done |
27 | 25 | ||
28 | # newline | 26 | # newline |
@@ -30,9 +28,9 @@ PS1+='\[\e[0m\]\n' | |||
30 | 28 | ||
31 | # exit code (only if error) | 29 | # exit code (only if error) |
32 | __prompt_exit_code() { | 30 | __prompt_exit_code() { |
33 | local ec=$? | 31 | local ec=$? |
34 | (( $ec > 0 )) && | 32 | (( $ec > 0 )) && |
35 | printf "$ec" | 33 | printf "$ec" |
36 | } | 34 | } |
37 | PS1+='\[\e[31m\]$(__prompt_exit_code)\[\e[0m\]' | 35 | PS1+='\[\e[31m\]$(__prompt_exit_code)\[\e[0m\]' |
38 | 36 | ||