Skip to content

Commit

Permalink
tweak bash_prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
klaemo committed May 28, 2016
1 parent 978e85f commit 9691b09
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions .bash_prompt
Expand Up @@ -53,65 +53,65 @@ prompt_git() {

[ -n "${s}" ] && s=" [${s}]";

echo -e "${1}${branchName}${blue}${s}";
echo -e "${1}${branchName}${red}${s}";
else
return;
fi;
}

if tput setaf 1 &> /dev/null; then
tput sgr0; # reset colors
bold=$(tput bold);
reset=$(tput sgr0);
# Solarized colors, taken from http://git.io/solarized-colors.
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
# if tput setaf 1 &> /dev/null; then
# tput sgr0; # reset colors
# bold=$(tput bold);
# reset=$(tput sgr0);
# # Solarized colors, taken from http://git.io/solarized-colors.
# 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;
reset="\033[0m";
black="\033[1;30m";
blue="\033[1;34m";
cyan="\033[1;36m";
green="\033[1;32m";
orange="\033[1;33m";
purple="\033[1;35m";
red="\033[1;31m";
violet="\033[1;35m";
white="\033[37m";
yellow="\033[1;33m";
# fi;

# Highlight the user name when logged in as root.
if [[ "${USER}" == "root" ]]; then
userStyle="${red}";
else
userStyle="${orange}";
userStyle="${green}";
fi;

# Highlight the hostname when connected via SSH.
if [[ "${SSH_TTY}" ]]; then
hostStyle="${bold}${red}";
hostStyle="\[${white}\] at \[${bold}${red}\]\h";
else
hostStyle="${yellow}";
hostStyle="";
fi;

# Set the terminal title to the current working directory.
PS1="\[\033]0;\w\007\]";
# PS1+="\[${bold}\]\n"; # newline
# Set the terminal title and prompt.
PS1="\[\033]0;\W\007\]"; # working directory base name
PS1+="\[${bold}\]\n"; # newline
PS1+="\[${userStyle}\]\u"; # username
PS1+="\[${white}\] at ";
PS1+="\[${hostStyle}\]\h"; # host
PS1+="\[${white}\] in ";
PS1+="\[${green}\]\w"; # working directory
PS1+="\$(prompt_git \"${white} on ${violet}\")"; # Git repository details
# PS1+="\[${white}\] at";
PS1+="${hostStyle}"; # host
PS1+="\[${reset}\] in ";
PS1+="\[${blue}\]\w"; # working directory full path
PS1+="\$(prompt_git \"\[${reset}\] on \[${yellow}\]\" \"\[${blue}\]\")"; # Git repository details
PS1+="\n";
PS1+="\[${white}\]\$ \[${reset}\]"; # `$` (and reset color)
export PS1;
Expand Down

0 comments on commit 9691b09

Please sign in to comment.