如何设置PS1,以使git和conda都可以在bash中显示? 带有virtualenv和git分支的Bash命令提示符
我发现如下关于如何在bash shell中进行此操作,但我在macosx中使用zsh。使用zsh是否会以同样的方式工作?我在我的~/.zshrc中有以下内容
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/carlos/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/blah/profile.d/conda.sh" ]; then
. "/blah/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/blah/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
我尝试使用此链接https://medium.com/pareture/simplest-zsh-prompt-configs-for-git-branch-name-3d01602a6f33,但它不包含git分支信息。有人能够扩展一下,以便包括git分支信息吗?