ubuntu下终端提示符颜色配置以及git分支配置

来源:互联网 发布:api接口网站源码 编辑:程序博客网 时间:2024/05/16 10:51
ubuntu下终端提示符颜色配置以及git分支配置
向~/.bashrc复制下面内容,然后重新打开终端就可以了。

颜色配置:   
PS1='${debian_chroot:+($debian_chroot)}/[/033[01;32m/]/u@/h/[/033[00m/]: /[/033[01;34m/]/w/[/033[00m/]/$'
颜色配置加git  分支:   
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]: \w \[\033[31m\]\$(parse_git_branch)\[\033[00m\]$\[\033[00m\] " 
0 0
原创粉丝点击