configs/home/.zsh/themes/spaceship-prompt/docs/faq.zh.md

7.2 KiB
Raw Permalink Blame History

常见问题

此页面旨在帮助您修复在使用 Spaceship 时遇到的常见问题。

如果你被某些问题困住,请随时在我们的 Discord 服务或 GitHub 论坛上提问:

:fontawesome-brands-discord: Discord{ .md-button } :fontawesome-brands-github: Discussions{ .md-button }

为什么我的提示符看起来不像预览?

预览显示 Spaceship 提示符设置为:

查看 屏幕截图 维基以了解更多的配色方案示例。

如何实现示例图中自动补全的功能?

使用 zsh-autosuggestions 获取基于历史记录和补全的类似浏览器的命令补全。

git 分支前的乱码是什么?

您需要有一个powerline的补丁字体才能正确显示 git 分支符号。

模块前面奇怪的字符是什么?

这并不是Spaceship提示符的问题。 Spaceship在模块中使用 Unicode 符号来代表 SPACESHIP_*_SYMBOL。 要解决此问题:

  • 使用此命令验证您的终端模拟器支持 Unicode 字符:
    curl - L https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt
    # 或
    wget -O - https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt
    
  • 配置您的终端模拟器使用UTF-8作为字符编码。
    • LC_ALL needs to be set to a UTF-8 value, like en_US.UTF-8 or de_DE.UTF-8, etc.
    • You need to install an emoji font. Most systems already have such font installed, but some systems don't (for example Arch Linux). You should install one via your preferred package manager. noto emoji is a popular choice.

如果不支持 Unicode 符号,您可以用 SPACESHIP_*_SYMBOL 选项替换它们与您终端兼容。 查看 ">选项 页面以获取更多信息。

Do spaceship remove <section> and SPACESHIP_<SECTION>_SHOW=false do the same thing?

Both spaceship remove and SPACESHIP_<SECTION>_SHOW=false commands hide the section from the prompt, but they do this differently.

spaceship remove command removes the section from SPACESHIP_[R]PROMPT_ORDER variable, thus preventing the section from loading and executing.

SPACESHIP_<SECTION>_SHOW=false command doesn't prevent the section from loading and executing. The section will be loaded and then run, though the section itself will decide how to hide itself (usually, the section just skips all the checks and doesn't render anything).

tldr: spaceship remove forces Spaceship renderer to skip the section and SPACESHIP_<SECTION>_SHOW=false tells the section to hide itself.

What the difference between Spaceship and Starship?

Both Starship is a great prompt and have (more or less) feature parity with Spaceship. So what is the difference?

Starship is written in Rust and comes as a successor of Spacefish a Fish implementation of the Spaceship prompt. It is heavily inspired by Spaceship prompt (they even confirm that on their website). It's also based on Denys Dovhan's ideas of cross-shell prompts that have been implemented in denysdovhan/robbyrussell-node as proof of concept.

Starship have advantage in supported shells, it works with roughly any shell. Spaceship is limited to Zsh, but uses most of the capabilities of Zsh.

Starship perform its checks asynchronously and renders the prompt as soon as it's ready. Spaceship not only performs checks asynchronously, but also renders the prompt right away and updates it as soon as new information comes from asynchronous tasks.

Spaceship considers custom sections as a first-class citizens and has a Registry of custom sections, whereas Starship suggests to use custom commands for creating custom modules.

If you use different machines with different shell prompts Starship might be a better choice for you. Spaceship is great if you prefer to use the same Zsh configuration of every machine you use.

What the difference between Spaceship and Powerlevel10k (with Lean style)?

Powerlevel10k (with Lean mode) is another Zsh prompt that might look very similar to Spaceship.

Both prompts are asynchronous and render the prompt as soon as it's ready. Powerlevel10k takes more monolith approach to prompt with tons of features built in a single prompt. Spaceship, however, takes a more modular approach to prompt with custom sections and more options for customizations.

On the other hand, Powerlevel10k suggests multiple design presets. Spaceship only supports one preset.

某些模块图标相互重叠?

example of icons overlapping

此问题与您的终端模拟器如何渲染Unicode 9字符有关。 要解决此问题:

  • 确保终端使用 Unicode 版本 9 宽度
  • 让您的终端以双宽度渲染不明确的字符。

iTerm 中,遵循这些指令:

  • 转至 iTerm → Preferences… (⌘,) → Profiles → Text
  • 检查 Unicode 版本 9 宽度
  • 检查 宽度模糊字符是否为双宽度
  • 重新装入终端标签页。

问题仍未解决

If any of above does not help, please, ask a question on our Discord server or file an issue, describe your problem, and we will gladly help you.

:fontawesome-brands-discord: Discord{ .md-button } :fontawesome-brands-github: Discussions{ .md-button } :fontawesome-brands-github: Open an Issue{ .md-button }