1
0
mirror of https://github.com/kremalicious/dotfiles.git synced 2024-06-25 18:56:21 +02:00

more minimal bash prompt

This commit is contained in:
Matthias Kretschmann 2015-09-25 11:16:30 +02:00
parent a5b6295e8a
commit 6e8564166f

View File

@ -53,9 +53,9 @@ prompt_git() {
git rev-parse --short HEAD 2> /dev/null || \
echo '(unknown)')";
[ -n "${s}" ] && s=" [${s}]";
[ -n "${s}" ] && s=" ${s}";
echo -e "${1}${branchName}${blue}${s}";
echo -e "${1}${branchName}${orange}${s}";
else
return;
fi;
@ -64,16 +64,19 @@ prompt_git() {
if tput setaf 1 &> /dev/null; then
tput sgr0; # reset colors
bold=$(tput bold);
dim=$(tput setaf 7);
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);
# Tomorrow colors, taken from https://github.com/Slava/vim-colors-tomorrow/blob/master/colors/tomorrow.vim
black=$(tput setaf 236);
gray=$(tput setaf 242);
blue=$(tput setaf 109);
green=$(tput setaf 143);
cyan=$(tput setaf 110);
orange=$(tput setaf 173);
purple=$(tput setaf 125);
red=$(tput setaf 124);
violet=$(tput setaf 61);
red=$(tput setaf 167);
magenta=$(tput setaf 139);
violet=$(tput setaf 139);
white=$(tput setaf 15);
yellow=$(tput setaf 136);
else
@ -107,16 +110,12 @@ fi;
# Set the terminal title to the current working directory.
PS1="\[\033]0;\w\007\]";
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+="\n";
PS1+="\[${white}\]→ \[${reset}\]"; # `→` (and reset color)
PS1+="\[${cyan}\]\w"; # working directory
PS1+="\$(prompt_git \" ${gray}\")"; # Git repository details
PS1+="\n";
PS1+="\[${dim}\]→ \[${reset}\]"; # `→` (and reset color)
export PS1;
PS2="\[${yellow}\]→ \[${reset}\]";
PS2="\[${dim}\]→ \[${reset}\]";
export PS2;