zsh 主题的完整路径 + 显示 git 更改
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27885057/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
zsh theme for full path + display git changes
提问by Ohad Perry
I'm looking for theme to display a full path + git (branch name + uncommitted changes + added files). Didn't find any. something like this:
我正在寻找显示完整路径 + git(分支名称 + 未提交的更改 + 添加的文件)的主题。没有找到。像这样:
/full/path/to/repo (master *+)
would love a recommendation of one / a tip of how to edit an existing one (I am currently using Godzilla).
很想推荐一个/关于如何编辑现有一个的提示(我目前正在使用哥斯拉)。
回答by mcls
Run man zshmisc
and search for the SIMPLE PROMPT ESCAPES
section.
This documents escapes which can be used to theme your prompt.
运行man zshmisc
并搜索该 SIMPLE PROMPT ESCAPES
部分。此文档转义可用于主题提示。
To get the full path path of your current working directory use %d
.
要获取当前工作目录的完整路径,请使用%d
.
I'm assuming you're using oh-my-zsh. In order to accomplish what you want, you can create a modified version of the Godzilla theme and replace the %c
(which just shows the current folder) with %d
in the PROMPT
.
我假设您正在使用 oh-my-zsh。为了完成你想要什么,你可以创建哥斯拉主题的修改版本,并替换%c
用(这只是显示当前文件夹)%d
中PROMPT
。
见这里:https: //github.com/robbyrussell/oh-my-zsh/blob/c78277fd8bda5fec87504469afdf121355876006/themes/gozilla.zsh-theme#L1