配置
vim ~/.bashrc
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
case "$PROMPT_ALTERNATIVE" in
twoline)
PS1=$prompt_color'┌──${debian_chroot:+($debian_chroot)──}${VIRTUAL_ENV:+(\[\033[0;1m\]$(basename $VIRTUAL_ENV)'$prompt_color')}('$info_color'\u'$prompt_symbol'\h'$prompt_color')-[\[\033[0;1m\]\w'$prompt_color']$(parse_git_branch)\n'$prompt_color'└─'$info_color'\$\[\033[0m\] ';;
生效
source /root/.bashrc
效果
┌──(venv-liam)(root㉿DESKTOP-IA03IH4)-[/work/flask01](master)
└─#
标签:Git,prompt,branch,color,虚拟环境,Branch,git,033
From: https://www.cnblogs.com/wl30564/p/16618284.html