在终端上显示当前分支 [英] Show current branch on terminal
本文介绍了在终端上显示当前分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么办法可以在VS Code
的Terminal
中显示在当前分支
的括号中?我在某处看到过,但不确定如何完成.通过某种扩展或其他方式..
Is there any way to show in Terminal
of VS Code
to show in brackets current branch
? I saw it somewhere but not sure how it can be done. By some extension or whatever..
C:/myUser/project> git status
我希望看到类似的内容:
I would like to see it something like:
C:/myUser/project>(master) git status
推荐答案
打开 zshrc 文件打开~/.zshrc
在zshrc文件末尾添加这段文字
自动加载 -Uz vcs_info
autoload -Uz vcs_info
precmd() { vcs_info }
precmd() { vcs_info }
zstyle ':vcs_info:git:*' 格式化 'on 分支 %b'
zstyle ':vcs_info:git:*' formats 'on branch %b'
setopt PROMPT_SUBST
setopt PROMPT_SUBST
PROMPT='%n in ${PWD/#$HOME/~} ${vcs_info_msg_0_} >'
PROMPT='%n in ${PWD/#$HOME/~} ${vcs_info_msg_0_} > '
源 zshrc 文件源代码 ~/.zshrc
Source zshrc file source ~/.zshrc
这篇关于在终端上显示当前分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文