--- /dev/null
+#!/bin/bash
+
+# bash_prompt
+
+# iTerm2 prefs: import Solarized theme (disable bright colors for bold text)
+# Color ref: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim
+# More tips: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
+
+if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
+ export TERM='gnome-256color';
+elif infocmp xterm-256color >/dev/null 2>&1; then
+ export TERM='xterm-256color';
+fi;
+
+if [ -f "${HOME}/.cache/bash/git-prompt.sh" ]; then
+ . "${HOME}/.cache/bash/git-prompt.sh"
+
+ # Enabling any of these options will slow down the prompt
+ 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'
+fi
+
+# Solarized colors
+# (https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized#the-values)
+set_prompts()
+{
+ if [ -x /usr/bin/tput ] && tput setaf 1 >& /dev/null; then
+ bold=$(tput bold)
+ reset=$(tput sgr0)
+
+ black=$(tput setaf 0)
+ blue=$(tput setaf 33)
+ cyan=$(tput setaf 37)
+ green=$(tput setaf 64)
+ orange=$(tput setaf 166)
+ purple=$(tput setaf 125)
+ red=$(tput setaf 124)
+ violet=$(tput setaf 61)
+ white=$(tput setaf 15)
+ yellow=$(tput setaf 136)
+ else
+ bold=""
+ reset="\e[0m"
+
+ black="\e[1;30m"
+ blue="\e[1;34m"
+ cyan="\e[1;36m"
+ green="\e[1;32m"
+ orange="\e[1;33m"
+ purple="\e[1;35m"
+ red="\e[1;31m"
+ violet="\e[1;35m"
+ white="\e[1;37m"
+ yellow="\e[1;33m"
+ fi
+
+ fg="$white"
+
+ # build the prompt
+
+ # logged in as root
+ if [[ "$USER" == "root" ]]; then
+ userStyle="$bold$red"
+ else
+ userStyle="$orange"
+ fi
+
+ # connected via ssh
+ if [[ "$SSH_TTY" ]]; then
+ hostStyle="$bold$red"
+ else
+ hostStyle="$yellow"
+ fi
+
+ # Set the terminal title to the current working directory.
+ PS1="\[\033]0;\w\007\]"
+
+ if [ -n "${BASH_VERSION}" ]; then
+ PS1+=$'\r' # carriage return
+ PS1+="\[$userStyle\]\u" # username
+ PS1+="\[$reset$fg\] at "
+ PS1+="\[$hostStyle\]\h" # host
+ PS1+="\[$reset$fg\] in "
+ PS1+="\[$green\]\w" # working directory
+ # PS1+="\$(prompt_git \"$white on $cyan\")" # git repository details
+ PS1+="\$(__git_ps1 '\[${fg}\] on \[${cyan}\]%s')"; # on branch
+ PS1+=$'\n' # newline
+ PS1+="\[$reset$fg\]\$ \[$reset\]" # $ (and reset color)
+
+ PS2="\[${yellow}\]→ " # `→`
+ PS2+="\[${reset}\]" # reset color
+ else
+ PS1+=$'\r' # carriage return
+ PS1+="\u at \h in \w on \$(__git_ps1 %s)"
+ PS1+=$'\n''\$ ' # newline and $
+
+ PS2="→ "
+ fi
+
+ export PS1 PS2
+}
+
+
+set_prompts
+unset set_prompts
+
+# Whenever displaying the prompt, write the previous line to disk
+export PROMPT_COMMAND="history -a";
+
+++ /dev/null
-#!/bin/bash
-
-# bash_prompt
-
-# iTerm2 prefs: import Solarized theme (disable bright colors for bold text)
-# Color ref: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim
-# More tips: http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
-
-if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
- export TERM='gnome-256color';
-elif infocmp xterm-256color >/dev/null 2>&1; then
- export TERM='xterm-256color';
-fi;
-
-if [ -f "${HOME}/.cache/bash/git-prompt.sh" ]; then
- . "${HOME}/.cache/bash/git-prompt.sh"
-
- # Enabling any of these options will slow down the prompt
- 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'
-fi
-
-# Solarized colors
-# (https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized#the-values)
-set_prompts()
-{
- if [ -x /usr/bin/tput ] && tput setaf 1 >& /dev/null; then
- bold=$(tput bold)
- reset=$(tput sgr0)
-
- black=$(tput setaf 0)
- blue=$(tput setaf 33)
- cyan=$(tput setaf 37)
- green=$(tput setaf 64)
- orange=$(tput setaf 166)
- purple=$(tput setaf 125)
- red=$(tput setaf 124)
- violet=$(tput setaf 61)
- white=$(tput setaf 15)
- yellow=$(tput setaf 136)
- else
- bold=""
- reset="\e[0m"
-
- black="\e[1;30m"
- blue="\e[1;34m"
- cyan="\e[1;36m"
- green="\e[1;32m"
- orange="\e[1;33m"
- purple="\e[1;35m"
- red="\e[1;31m"
- violet="\e[1;35m"
- white="\e[1;37m"
- yellow="\e[1;33m"
- fi
-
- fg="$white"
-
- # build the prompt
-
- # logged in as root
- if [[ "$USER" == "root" ]]; then
- userStyle="$bold$red"
- else
- userStyle="$orange"
- fi
-
- # connected via ssh
- if [[ "$SSH_TTY" ]]; then
- hostStyle="$bold$red"
- else
- hostStyle="$yellow"
- fi
-
- # Set the terminal title to the current working directory.
- PS1="\[\033]0;\w\007\]"
-
- if [ -n "${BASH_VERSION}" ]; then
- PS1+=$'\r' # carriage return
- PS1+="\[$userStyle\]\u" # username
- PS1+="\[$reset$fg\] at "
- PS1+="\[$hostStyle\]\h" # host
- PS1+="\[$reset$fg\] in "
- PS1+="\[$green\]\w" # working directory
- # PS1+="\$(prompt_git \"$white on $cyan\")" # git repository details
- PS1+="\$(__git_ps1 ' \[${fg}\]on \[${cyan}\]%s')"; # on branch
- PS1+=$'\n' # newline
- PS1+="\[$reset$fg\]\$ \[$reset\]" # $ (and reset color)
-
- PS2="\[${yellow}\]→ " # `→`
- PS2+="\[${reset}\]" # reset color
- else
- PS1+=$'\r' # carriage return
- PS1+="\u at \h in \w on \$(__git_ps1 %s)"
- PS1+=$'\n''\$ ' # newline and $
-
- PS2="→ "
- fi
-
- export PS1 PS2
-}
-
-
-set_prompts
-unset set_prompts
-
-# Whenever displaying the prompt, write the previous line to disk
-export PROMPT_COMMAND="history -a";
-