Skip to content

Commit

Permalink
previous prompt messed with bash history somehow
Browse files Browse the repository at this point in the history
  • Loading branch information
pkruithof committed Mar 12, 2012
1 parent a022e5e commit 8341240
Showing 1 changed file with 46 additions and 32 deletions.
78 changes: 46 additions & 32 deletions .bash_prompt
Expand Up @@ -3,33 +3,55 @@
# Screenshot: http://i.imgur.com/s0Blh.png

if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM=xterm-256color
export TERM=xterm-256color
fi

tput sgr 0 0

# Base styles and color palette
# Solarized colors
# https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized
BOLD=$(tput bold)
RESET=$(tput sgr0)
SOLAR_YELLOW=$(tput setaf 136)
SOLAR_ORANGE=$(tput setaf 166)
SOLAR_RED=$(tput setaf 124)
SOLAR_MAGENTA=$(tput setaf 125)
SOLAR_VIOLET=$(tput setaf 61)
SOLAR_BLUE=$(tput setaf 33)
SOLAR_CYAN=$(tput setaf 37)
SOLAR_GREEN=$(tput setaf 64)
SOLAR_WHITE=$(tput setaf 254)
if tput setaf 1 &> /dev/null; then
tput sgr0
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
SOLAR_YELLOW=$(tput setaf 136)
SOLAR_ORANGE=$(tput setaf 166)
SOLAR_RED=$(tput setaf 124)
SOLAR_MAGENTA=$(tput setaf 125)
SOLAR_VIOLET=$(tput setaf 61)
SOLAR_BLUE=$(tput setaf 33)
SOLAR_CYAN=$(tput setaf 37)
SOLAR_GREEN=$(tput setaf 64)
SOLAR_WHITE=$(tput setaf 254)
else
SOLAR_YELLOW=$(tput setaf 5)
SOLAR_ORANGE=$(tput setaf 4)
SOLAR_RED=$(tput setaf 2)
SOLAR_MAGENTA=$(tput setaf 1)
SOLAR_VIOLET=$(tput setaf 7)
SOLAR_BLUE=$(tput setaf 6)
SOLAR_CYAN=$(tput setaf 3)
SOLAR_GREEN=$(tput setaf 8)
SOLAR_WHITE=$(tput setaf 9)
fi
BOLD=$(tput bold)
RESET=$(tput sgr0)
else
SOLAR_YELLOW="\033[1;31m"
SOLAR_ORANGE="\033[1;32m"
SOLAR_RED="\033[1;33m"
SOLAR_MAGENTA="\033[1;34m"
SOLAR_VIOLET="\033[1;35m"
SOLAR_BLUE="\033[1;36m"
SOLAR_CYAN="\033[1;37m"
SOLAR_GREEN="\033[1;38m"
SOLAR_WHITE="\033[1;39m"
BOLD=""
RESET="\033[m"
fi

style_user="$RESET$SOLAR_ORANGE"
style_host="$RESET$SOLAR_YELLOW"
style_path="$RESET$SOLAR_GREEN"
style_branch="$RESET$SOLAR_CYAN"
style_chars="$RESET$SOLAR_WHITE"
style_user="$SOLAR_ORANGE"
style_host="$SOLAR_YELLOW"
style_path="$SOLAR_GREEN"
style_branch="$SOLAR_CYAN"
style_chars="$SOLAR_WHITE"

if [[ "$SSH_TTY" ]]; then
# connected via ssh
Expand Down Expand Up @@ -64,12 +86,4 @@ function prompt_git() {


# Build the prompt
PS1="\n" # Newline
PS1+="$style_user\u" # Username
PS1+="$style_chars@" # @
PS1+="$style_host\h" # Host
PS1+="$style_chars: " # :
PS1+="$style_path\w" # Working directory
PS1+="\$(prompt_git)" # Git details
PS1+="\n" # Newline
PS1+="$style_chars\$ $RESET" # $ (and reset color)
PS1="\n\[$style_user\]\u\[$style_chars@\]\[$style_host\]\h\[$style_chars\]: \[$style_path\]\w\$(prompt_git)\n\[$style_chars\]\$ \[$RESET\]"

0 comments on commit 8341240

Please sign in to comment.