Mac重新修改terminal显示git分支(show git branch prompt)

# Enabling and setting git info var to be used in prompt config.
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
# This line obtains information from the vcs.
zstyle ':vcs_info:git*' formats " - (%b)"
precmd() {
    vcs_info
}

# Enable substitution in the prompt.
setopt prompt_subst

# Config for the prompt. PS1 synonym.
prompt='$ %1/${vcs_info_msg_0_} %% '
posted @ 2021-06-23 16:14  SteveYu  阅读(250)  评论(0编辑  收藏  举报