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