Shorten directory in prompt when in a git repo.
dblume

dblume commited on 2021-11-02 11:39:15
Showing 1 changed files, with 2 additions and 1 deletions.

... ...
@@ -9,8 +9,8 @@ parse_git_branch() {
9 9
     #git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
10 10
 }
11 11
 
12
-export PROMPT_DIRTRIM=4
13 12
 if true ; then
13
+    export PROMPT_DIRTRIM=1
14 14
     # I like 023 or 030 for the git branch color. See https://i.stack.imgur.com/UQVe5.png
15 15
     if [[ -n $SSH_CLIENT ]]; then
16 16
         export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93";
... ...
@@ -20,6 +20,7 @@ if true ; then
20 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 21
     fi
22 22
 else
23
+    export PROMPT_DIRTRIM=4
23 24
     if [[ -n $SSH_CLIENT ]]; then
24 25
         export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93";
25 26
                       else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\h:\w$\[\e[0m\] '
26 27