6月6日更新现在没有bug了,也更简洁了
tip:最好能看懂哪部分是颜色哪部分标识文本
简单教程https://zhuanlan.zhihu.com/p/60880207
# git补全
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
export BASH_SILENCE_DEPRECATION_WARNING=1 #使用bash而不是zsh
export CLICOLOR=1
export LSCOLORS=ExGxFxdaCxDaDahbadeche
#控制台配色
git_branch()
{
branch=`git rev-parse --abbrev-ref HEAD 2>/dev/null`
if [ "${branch}" != "" ]
then
if [ "${branch}" = "(no branch)" ]
then
branch="(`git rev-parse --short HEAD`...)"
fi
echo "($branch)"
fi
}
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \w\[\033[0;33m\] $(git_branch)\[\033[0;33m\]\[\033[0m\033[0;33m\] \$\[\033[0m\033[0;33m\]\[\033[0m\] '
搞了好多