Created
March 28, 2018 05:17
-
-
Save opt9/7bdc5eaab8eb7626dcffae6f90e5e130 to your computer and use it in GitHub Desktop.
CentOS 7 Bash + Git + VirtualEnv + Jobs Shell Prompt Tip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# User specific aliases, functions and config | |
# Git prompt config | |
if [ -f ~/.local/share/git/git-prompt.sh ]; then | |
. ~/.local/share/git/git-prompt.sh | |
fi | |
GIT_PS1_SHOWDIRTYSTATE=1 | |
GIT_PS1_SHOWSTASHSTATE=1 | |
GIT_PS1_SHOWUNTRACKEDFILES=1 | |
GIT_PS1_SHOWUPSTREAM='auto' | |
# disable the default virtualenv prompt change | |
export VIRTUAL_ENV_DISABLE_PROMPT=1 | |
function virtualenv_prompt() { | |
if [ -n "$VIRTUAL_ENV" ]; then | |
echo "(${VIRTUAL_ENV##*/}) " | |
fi | |
} | |
PROMPT_COMMAND='hasjobs=$(jobs -p)' | |
PS1='\[\033[01;33m\]$(virtualenv_prompt)\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;35m\]$(__git_ps1 " (%s)")\[\033[01;32m\] ${hasjobs:+(\j) }\[\033[00;32m\]\$\[\033[00m\] ' | |
export PS1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment