【问题标题】:How to disable Powerlevel10k in Warp and install Starship如何在 Warp 中禁用 Powerlevel10k 并安装 Starship
【发布时间】:2023-01-28 06:55:51
【问题描述】:

我刚刚安装了 Warp 终端,我很喜欢它。

但我想使用 Starship 自定义提示,并且在我的 iTerm2 终端上仍然有 Powerlevel10k。可能吗?

【问题讨论】:

  • 我正在经历完全相同的问题。同样在重新安装所有内容并完全删除 p10k 时。 Startship 提示自定义在 iTerm2 上工作正常但在 Warp 上不起作用。
  • 我设法使它工作。你能用你的 .zshrc 和 starship.toml 文件更新你的问题吗?

标签: terminal zsh iterm2 warp


【解决方案1】:

几个小时后,我设法在 Warp 上安装了 Starship,并且在 iTerm(和所有其他终端)上仍然有 Powerlevel10k 修改我的 .zshrc 文件,如 Warp documentation 所说。

所以在文件的开头,我包装了 Powelevel10k 初始化以仅在终端不是 Warp 时激活它:

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
    if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
      source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
    fi
fi

我在文件末尾包装了 Warp 的 Starship 初始化:

if [[ $TERM_PROGRAM == "WarpTerminal" ]]; then
    eval "$(starship init zsh)"
fi

【讨论】:

    【解决方案2】:

    如果仍然缺少提示,我会在@Christian 回答中添加小提示:

    if [[ $TERM_PROGRAM == "iTerm.app" ]]; then
      test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
    fi
    

    shell 集成经常会导致问题(例如https://github.com/warpdotdev/Warp/issues/1518)——对我来说也是如此,条件初始化有助于解决问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-02
      • 1970-01-01
      • 2022-01-13
      • 2019-06-25
      • 2014-12-22
      • 2020-11-17
      • 2015-08-20
      • 1970-01-01
      相关资源
      最近更新 更多