Merge pull request #1424 from matrig/theme_sexy_with_python

Add theme/sexy-python
pull/1436/head
Nils Winkler 2019-10-16 09:07:00 +02:00 committed by GitHub
commit 04289e0400
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -1,6 +1,13 @@
# Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt"
# Screenshot: http://cloud.gf3.ca/M5rG
# A big thanks to \amethyst on Freenode
#
# Configuration:
# * To visualize python environment (virtualenv and conda) add in your .bash_profile the following line:
# export SEXY_THEME_SHOW_PYTHON=true
# Default setting
SEXY_THEME_SHOW_PYTHON="${SEXY_THEME_SHOW_PYTHON:=false}"
if tput setaf 1 &> /dev/null; then
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
@ -34,9 +41,16 @@ parse_git_dirty () {
parse_git_branch () {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
env_prompt () {
echo -e "($(virtualenv_prompt)$(condaenv_prompt))"
}
function prompt_command() {
PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]"
if [ "$SEXY_THEME_SHOW_PYTHON" = true ] ; then
PS1="\[${BOLD}${WHITE}\]$(env_prompt) "$PS1
fi
}
safe_append_prompt_command prompt_command