From ea317ddda89bde709a21ef8a3f3fbbc088821d48 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 24 Feb 2016 13:37:48 +0300 Subject: [PATCH] .bash_prompt: change colors and styles --- .bash_prompt | 60 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/.bash_prompt b/.bash_prompt index 1d4f245..6284416 100644 --- a/.bash_prompt +++ b/.bash_prompt @@ -136,34 +136,52 @@ set_prompts() { dim_yellow="\e[1;33m" fi - # build the prompt + charStyle="$reset$bold$black" + gitStyle="\[$white\]on \[$magenta\]" + case "$BACKGROUND" in + DARK|dark) + hostStyle="$reset$cyan" + ;; + LIGHT|light) + hostStyle="$reset$blue" + ;; + esac + wdirStyle="$reset$green" + # logged in as root if [[ "$USER" == "root" ]]; then - userStyle="\[$bold$red\]" + userStyle="$bold$red" else - userStyle="\[$orange\]" + 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\]" - - PS1+="\n" # newline + # build the prompt + # display the user, host and current working directory in the terminal title + case "$TERM" in + *rxvt*|screen*|*term*|vt100) + PS1="\[\033]0;\u@\h:\w\007\]" + case "$TERM" in + screen*) + PS1+"\[\033k\u@\h:\w\033\\\]" # Set screen/tmux caption + ;; + esac + ;; + + *) + PS1="" + ;; + esac + + #PS1+="\n" # newline PS1+="\[$userStyle\]\u" # username - PS1+="\[$reset$white\]@" - PS1+="\[$hostStyle\]\h" # host - PS1+="\[$reset$white\]: " - PS1+="\[$green\]\w" # working directory - PS1+="\$(prompt_git \"$white on $cyan\")" # git repository details - PS1+="\n" - PS1+="\[$reset$white\]\$ \[$reset\]" # $ (and reset color) + PS1+="\[$charStyle\]@" + PS1+="\[$hostStyle\]\h " # host + #PS1+="\[$charStyle\]: " + PS1+="\[$wdirStyle\]\W " # working directory + PS1+="\$(prompt_git \"$gitStyle\")" # git repository details + #PS1+="\n" + PS1+="\[$charStyle\]\$ \[$reset\]" # $ (and reset color) export PS1 } -- 2.39.5