如何更改 zsh 中的提示?

How do I change the prompt in zsh?

我有 iTerm(带 zsh),它看起来像:

当我点击 Enter 时:

我想在终端顶部显示有关电池的 pin 信息,可以吗?

您可以使用 Tmux to pin a battery indicator。 Tmux 不是 Zsh 或 iTerm 的一部分,而是一个非常轻量级的工具,对于 window/pane 管理等其他事情也很有用。

使用 tmux 的解决方案:

  1. 安装brew install tmux
  2. 添加到 ~/.tmux.conf: set -g status-position top
  3. 加载配置:tmux source-file ~/.tmux.conf
  4. 运行 tmux

现在您可以使用 tmux 配置将任何信息添加到顶行。