vcprompt 未在提示中设置已修改和未提交
在 OSX 上使用 iTerm2 和/或终端 - 我已经安装了最新版本的 vcprompt 并且可以正常工作。我似乎无法在提示中获得反映修改的(+)和未提交的(?)的格式。
即 $user: 路径 [git:branch +?]
。
在 .bash_login
<代码> print_before_prompt (){
printf "\e[0;35m%s: \e[0;36m%s \e[0;33m%s\e[0m \n" "$USER" "$PWD" "$(vcprompt -f %n :%b %u%m)" }
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
PROMPT_COMMAND=print_before_prompt
PS1="→ "
PS2=“>”
<代码><代码>
还在 --global git 配置文件中添加了 bash.showDirtyState true
但我没有得到预期的指标:实际上它所做的只是从 [git:branch] 周围删除 []。 $user: path git:branch
我知道这很边缘,但对此提供帮助会很棒 -
Using iTerm2 and-or Terminal on OSX - Ive got the lastest version of vcprompt installed and working to a point. I cant seem to get the format to reflect modified (+) and uncommitted (?) in my prompt.
i.e. $user: path [git:branch +?]
.
In .bash_login
print_before_prompt (){
printf "\e[0;35m%s: \e[0;36m%s \e[0;33m%s\e[0m \n" "$USER" "$PWD" "$(vcprompt -f %n:%b %u%m)"
}
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
PROMPT_COMMAND=print_before_prompt
PS1="→ "
PS2=" > "
in --global git config file
Also added bash.showDirtyState true
but I dont get the indicators as expected: actually all it does is remove the [ ] from around [git:branch]. $user: path git:branch
I know this is pretty fringe but help on this would be great --
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您忘记指定您正在谈论的 vcprompt - 我是原始 C 版本的作者 (https://bitbucket.org/gward/vcprompt" rel="nofollow">https:/ /bitbucket.org/gward/vcprompt),但我知道至少有两个重新实现“借用”了 vcprompt 这个名称。无论如何,我只能回答我的版本。
我不认为当你最初发布你的问题时,这个功能是为 git 实现的,这可以解释为什么它当时不起作用。
它应该在最新版本的 vcprompt 中工作正常(我写这篇文章时为 1.1,很快就会推出 1.2)。我相信 vcprompt 1.1 是由 OS X 的 homebrew 打包的,所以它应该很容易安装/升级。
You forgot to specify which vcprompt you're talking about -- I'm the author of the original C version (https://bitbucket.org/gward/vcprompt), but I know of at least two re-implementations which have "borrowed" the name vcprompt. Anyways, I can only answer for my version.
I don't think this feature was implemented for git when you posted your question originally, which would explain why it didn't work back then.
It should be working fine in the latest version of vcprompt (1.1 as I write this, 1.2 coming shortly). I believe vcprompt 1.1 is packaged by homebrew for OS X, so it should be easy to install/upgrade.