]> git.zndr.dk Git - dotfiles.git/commitdiff
Add no-color prompt
authorJannik Zander <jannikz@gmail.com>
Mon, 23 May 2016 18:17:26 +0000 (20:17 +0200)
committerJannik Zander <jannikz@gmail.com>
Mon, 23 May 2016 18:17:26 +0000 (20:17 +0200)
.config/profile/rc/prompt.sh

index 6a884d47ca7d201a020dc7ff4e52fe481fcdc992..e8a0a6bfa2f18a4ee27cc84866a13b8ee365f1db 100644 (file)
@@ -18,11 +18,12 @@ if [ ! -f "${HOME}/.config/profile/rc/git-prompt.sh" ]; then
 fi
 
 if [ -f "${HOME}/.config/profile/rc/git-prompt.sh" ]; then
-  . ${HOME}/.config/profile/rc/git-prompt.sh
+  . "${HOME}/.config/profile/rc/git-prompt.sh"
   # Enabling any of these options will slow down the prompt
-  export GIT_PS1_SHOWDIRTYSTATE=1
-  export GIT_PS1_SHOWSTASHSTATE=1
-  export GIT_PS1_SHOWUNTRACKEDFILES=1
+  export GIT_PS1_SHOWDIRTYSTATE='y'
+  export GIT_PS1_SHOWSTASHSTATE='y'
+  export GIT_PS1_SHOWUNTRACKEDFILES='y'
+  export GIT_PS1_DESCRIBE_STYLE='contains'
   export GIT_PS1_SHOWUPSTREAM="auto"
   export GIT_PS1_STATESEPARATOR=" ["
 fi
@@ -144,25 +145,31 @@ set_prompts()
       hostStyle="\[$yellow\]"
   fi
 
-  # Set the terminal title to the current working directory.
-  PS1="\[\033]0;\w\007\]"
+  if [ -n "${BASH_VERSION}" ]; then
 
-  PS1+="\n" # newline
-  PS1+="\[$userStyle\]\u" # username
-  PS1+="\[$reset$white\] at "
-  PS1+="\[$hostStyle\]\h" # host
-  PS1+="\[$reset$white\] in "
-  PS1+="\[$green\]\w" # working directory
-#  PS1+="\$(prompt_git \"$white on $cyan\")" # git repository details
-  PS1+="\$(__git_ps1 ' \[${white}\]on \[${cyan}\]%s]')";  # on branch
-  PS1+="\n"
-  PS1+="\[$reset$white\]\$ \[$reset\]" # $ (and reset color)
+    # Set the terminal title to the current working directory.
+    PS1="\[\033]0;\w\007\]"
 
-  export PS1
+    PS1+="\n" # newline
+    PS1+="\[$userStyle\]\u" # username
+    PS1+="\[$reset$white\] at "
+    PS1+="\[$hostStyle\]\h" # host
+    PS1+="\[$reset$white\] in "
+    PS1+="\[$green\]\w" # working directory
+  #  PS1+="\$(prompt_git \"$white on $cyan\")" # git repository details
+    PS1+="\$(__git_ps1 ' \[${white}\]on \[${cyan}\]%s]')";  # on branch
+    PS1+="\n"
+    PS1+="\[$reset$white\]\$ \[$reset\]" # $ (and reset color)
 
-  PS2="\[${yellow}\]→ " # `→`
-  PS2+="\[${reset}\]" # reset color
+    PS2="\[${yellow}\]→ " # `→`
+    PS2+="\[${reset}\]" # reset color
+  else
+    PS1="\u at \h in \w on \$(__git_ps1 %s])\n\$ "
 
+    PS2="→ "
+  fi
+
+  export PS1
   export PS2;
 }