当我使用 ZSH 的主题 Powerlevel10k 时,我遇到了问题?

苏凯承*_*苏凯承 2 oh-my-zsh

当我使用 ZSH 的主题 Powerlevel10k 时,我遇到了问题?

截屏

Rom*_*tsa 7

来自Powerlevel10k 常见问题解答

问:Git 状态中的不同符号是什么意思?

使用LeanClassicRainbow风格时,Git 状态可能如下所示:

feature:master ?42?42 *42 merge ~42 +42 !42 ?42
Run Code Online (Sandbox Code Playgroud)

传奇:

| Symbol  | Meaning                                                           | Source                                               |
| --------| ------------------------------------------------------------------| ---------------------------------------------------- |
| feature | current branch; replaced with #tag or @commit if not on a branch  | git status                                           |
| master  | remote tracking branch; only shown if different from local branch | git rev-parse --abbrev-ref --symbolic-full-name @{u} |
| ?42     | this many commits behind the remote                               | git status                                           |
| ?42     | this many commits ahead of the remote                             | git status                                           |
| *42     | this many stashes                                                 | git stash list                                       |
| merge   | repository state                                                  | git status                                           |
| ~42     | this many merge conflicts                                         | git status                                           |
| +42     | this many staged changes                                          | git status                                           |
| !42     | this many unstaged changes                                        | git status                                           |
| ?42     | this many untracked files                                         | git status                                           |
Run Code Online (Sandbox Code Playgroud)

另请参阅:如何更改 Git 状态的格式?

如果您在主目录的根目录下创建了一个 Git 存储库来存储点文件,您可能希望忽略其中未跟踪的文件。您可以通过执行以下命令来实现此目的:

feature:master ?42?42 *42 merge ~42 +42 !42 ?42
Run Code Online (Sandbox Code Playgroud)

这将有几个影响:

  • git status 会更快。
  • git status 不会列出 171 个未跟踪的文件。
  • ?171 将从您的提示中消失。

您可以使用以下命令撤消上述命令:

| Symbol  | Meaning                                                           | Source                                               |
| --------| ------------------------------------------------------------------| ---------------------------------------------------- |
| feature | current branch; replaced with #tag or @commit if not on a branch  | git status                                           |
| master  | remote tracking branch; only shown if different from local branch | git rev-parse --abbrev-ref --symbolic-full-name @{u} |
| ?42     | this many commits behind the remote                               | git status                                           |
| ?42     | this many commits ahead of the remote                             | git status                                           |
| *42     | this many stashes                                                 | git stash list                                       |
| merge   | repository state                                                  | git status                                           |
| ~42     | this many merge conflicts                                         | git status                                           |
| +42     | this many staged changes                                          | git status                                           |
| !42     | this many unstaged changes                                        | git status                                           |
| ?42     | this many untracked files                                         | git status                                           |
Run Code Online (Sandbox Code Playgroud)

如果您不想在主目录中的提示中看到 Git 状态,请将此参数添加到~/.p10k.zsh

# Don't display Git status in prompt for Git repositories whose workdir matches
# this pattern.
typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
Run Code Online (Sandbox Code Playgroud)

如果你不希望看到你的提示,在所有的Git的状态,除去vcsPOWERLEVEL9K_LEFT_PROMPT_ELEMENTS阵列~/.p10k.zsh