vim ~/.bash_profile
a :编辑模式
esc :命令模式
:wq :保存并退出
1 2 3 4 5 6
| # for color export CLICOLOR=1 # \h:\W \u\$ export PS1='\[\033[01;33m\]\u@\h\[\033[01;31m\] \W\$\[\033[00m\] ' # grep alias grep='grep --color=always'
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| find_git_branch () { local dir=. head until [ "$dir" -ef / ]; do if [ -f "$dir/.git/HEAD" ]; then head=$(< "$dir/.git/HEAD") if [[ $head = ref:\ refs/heads/* ]]; then git_branch="<${head#*/*/}>" elif [[ $head != '' ]]; then git_branch="<(detached)>" else git_branch="<(unknow)>" fi return fi dir="../$dir" done git_branch='' } export CLICOLOR=1 PROMPT_COMMAND="find_git_branch; $PROMPT_COMMAND" export PS1='\[\033[01;33m\]\u@\[\033[01;31m\]\W\[\033[00;31m\] $git_branch\[\033[01;31m\]\$\[\033[00m\] '
|