既然我已经升级到雪豹,如何修复我的 zsh 提示符?
我最近将系统升级到雪豹,现在我的提示无法正常工作。我的 .zshrc 文件中有这一行:(
PROMPT='%{$fg_no_bold[cyan]%}%n@%{$fg_no_bold[red]%}%m%{$fg_no_bold[green]%}$(git_branch)%{$reset_color%}: '
其中“git_branch”是一个函数,它为我提供有关我正在处理的当前 git 分支的信息)。问题是颜色和“git_branch”函数没有被评估,它们是按字面意思理解的,所以我的提示是:
%{$fg_no_bold[cyan]%}username@%{$fg_no_bold[red]%}machinename%{$fg_no_bold[green]%}$(git_branch)%{$reset_color%}:
颜色很好,但我真正想要工作的部分是 git 分支信息。我一直在谷歌搜索,但还没有找到任何东西。当谈到 zsh 时,我有点菜鸟,因此也将不胜感激有用资源的链接。
zsh --version
zsh 4.3.9 (i386-apple-darwin10.0)
I recently upgraded my system to snow leopard and now my prompt doesn't work properly. I have this line in my .zshrc file:
PROMPT='%{$fg_no_bold[cyan]%}%n@%{$fg_no_bold[red]%}%m%{$fg_no_bold[green]%}$(git_branch)%{$reset_color%}: '
(where "git_branch" is a function that give me information about the current git branch I'm working on). The problem is that the colors and "git_branch" function aren't being evaluated, they are taken literally, so my prompt is:
%{$fg_no_bold[cyan]%}username@%{$fg_no_bold[red]%}machinename%{$fg_no_bold[green]%}$(git_branch)%{$reset_color%}:
The colors are nice, but the part I'd really like to get working is the git branch info. I've been googling, but haven't found anything yet. I'm a bit of a noob when it comes to zsh, so links to helpful resources would also be appreciated.
zsh --version
zsh 4.3.9 (i386-apple-darwin10.0)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看一堆配置文件后,我发现添加这些行:
导致我的提示再次正确解释我的颜色代码。
After looking at a bunch of config files I discovered that adding these lines:
caused my prompt to correctly interpret my color codes again.