dblume commited on 2021-11-02 11:16:37
Showing 1 changed files, with 20 additions and 2 deletions.
... | ... |
@@ -4,11 +4,29 @@ if [[ $(uname -s) != Darwin* ]] && [ -f /etc/bashrc ]; then |
4 | 4 |
. /etc/bashrc |
5 | 5 |
fi |
6 | 6 |
|
7 |
+parse_git_branch() { |
|
8 |
+ git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ ⌥\1/' |
|
9 |
+ #git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/' |
|
10 |
+} |
|
11 |
+ |
|
7 | 12 |
export PROMPT_DIRTRIM=4 |
13 |
+if true ; then |
|
14 |
+ # I like 023 or 030 for the git branch color. See https://i.stack.imgur.com/UQVe5.png |
|
8 | 15 |
if [[ -n $SSH_CLIENT ]]; then |
9 |
- export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\h:\w$\[\e[0m\] ' |
|
16 |
+ export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; |
|
17 |
+ else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\h:\w\[\e[38;5;024m\]$(parse_git_branch)\[\e[38;5;242m\]$\[\e[0m\] ' |
|
18 |
+ else |
|
19 |
+ export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; |
|
20 |
+ else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\w\[\e[38;5;030m\]$(parse_git_branch)\[\e[38;5;242m\]$\[\e[0m\] ' |
|
21 |
+ fi |
|
10 | 22 |
else |
11 |
- export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\w$\[\e[0m\] ' |
|
23 |
+ if [[ -n $SSH_CLIENT ]]; then |
|
24 |
+ export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; |
|
25 |
+ else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\h:\w$\[\e[0m\] ' |
|
26 |
+ else |
|
27 |
+ export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; |
|
28 |
+ else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\w$\[\e[0m\] ' |
|
29 |
+ fi |
|
12 | 30 |
fi |
13 | 31 |
|
14 | 32 |
set -o vi |
15 | 33 |