Variables color, prompt

This commit is contained in:
Meutel 2017-05-01 12:51:38 +02:00
parent ab46714371
commit 39894df7d3

29
_bashrc
View File

@ -29,6 +29,16 @@ if [ "$TERM" != "dumb" ]; then
[ -x /usr/bin/dircolors ] && eval "`dircolors -b`"
fi
GREEN='\[\033[0;32m\]'
GREENB='\[\033[1;32m\]'
RED='\[\033[0;31m\]'
REDB='\[\033[1;31m\]'
BLUE='\033[0;34m\]'
BLUEB='\033[1;34m\]'
WHITE='\[\033[0;37m\]'
WHITEB='\[\033[1;37m\]'
RESET='\[\033[0;00m\]'
##### FUNCTIONS #####
# status indicator
@ -36,11 +46,10 @@ prompt_status()
{
if [[ "$?" == "0" ]]
then
echo -n '\[\033[1;32m\]>'
echo -n "${GREENB}-"
else
echo -n '\[\033[1;31m\]X'
echo -n "${REDB}X"
fi
echo -n '\[\033[1;31m\]'
}
##### INCLUDES #####
@ -89,9 +98,15 @@ export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
##### PROMPT #####
PS1_pre="\[\033[1;31m\]>> \[\033[01;37m\](\[\033[0;37m\]\u@\[\033[0;32m\]\h\[\033[01;37m\]) \[\033[01;34m\]\w\[\033[00m\]"
PS1_post="\[\033[1;31m\]$(prompt_status)>\[\033[0;37m\] "
PS1="${PS1_pre}\n${PS1_post}"
__ps1()
{
ps1pre="$1"
ps1post="$2"
PS1="$ps1pre$ps1post"
}
PS1pre='"${REDB}>> ${WHITEB}(${WHITE}\u@${GREEN}\h${WHITEB}) ${BLUEB}\w${RESET}"'
PS1post='"\n$(prompt_status)${REDB}>${WHITE} "'
PROMPT_COMMAND="__ps1 $PS1pre $PS1post"
##### GIT #####
@ -110,6 +125,6 @@ if [ -e /usr/local/share/git-core/contrib/completion/git-prompt.sh ] || [ -e /us
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM="auto"
export GIT_PS1_SHOWCOLORHINTS=1
export PROMPT_COMMAND='__git_ps1 "$PS1_pre" "\n$PS1_post"'
PROMPT_COMMAND="__git_ps1 $PS1pre $PS1post"
fi