git - 使用 prezto 的 zsh 具有与左侧相同级别的右侧提示

标签 git zsh prezto zsh-zle

我是 zsh 的新手,也是 prezto 的新手.现在,就像在我的 bash shell 中一样,我希望在左侧显示当前路径,在右侧显示我的当前分支,正如您在图片中看到的那样,到目前为止一切顺利......

Prompt

...现在问题是提示的正确部分在第二行而不是路径所在的那一行!

# Define prompts.
PROMPT="
[ ${_prompt_steeef_colors[3]}%n%f@${_prompt_steeef_colors[2]}%m%f ] ${_prompt_steeef_colors[5]}%~%f 
"'$python_info[virtualenv]'"$ "
RPROMPT='${vcs_info_msg_0_}'

(完整源代码:here)

How can I achieve both path and branch at the same line in my custom prezto prompt?

最佳答案

如果您不关心调整窗口大小时的渲染瑕疵,您可以使用控制字符破解此功能:

local _lineup=$'\e[1A'
local _linedown=$'\e[1B'
RPROMPT=%{${_lineup}%}"some stuff"%{${_linedown}%}

我在这里找到了这个:https://superuser.com/questions/357107/zsh-right-justify-in-ps1/737454#737454

关于git - 使用 prezto 的 zsh 具有与左侧相同级别的右侧提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36343731/

相关文章:

git - 'git submodule init' 有什么意义?

shell - 子shell中对$RANDOM的引用都返回相同的值

zsh - theme_precmd :1: vcs_info: function definition file not found For Oh-my-zsh

bash - 为 zsh + Prezto 主题安装电力线字体

git - 如何在保留提交历史记录的同时恢复 git repo?

linux - 我怎样才能提取每个 linux 内核提交请求?

zsh - `(.N)` 在这个扩展的 glob 中做了什么?

linux - ZSH 不使用 "sudo -s"加载我的 prezto 配置文件

git - 如何在存储库历史记录中的每个 git 提交中查找字数?

linux - source、zsh、 "."和直接shell脚本调用的区别