starship/docs/zh-CN/presets/README.md

537 lines
8.2 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 预设
这里有一系列社区提供的 Starship 预设。 如果您想分享一套配置,请 [提交 PR](https://github.com/starship/starship/edit/master/docs/presets/README.md) 来更新此文件! 😊
## Nerd 字体符号
除了每个组件使用的符号外,这套配置不会改变任何内容。 如果你不喜欢 emoji这可能能满足你
![Screenshot of Nerd Font Symbols preset](/presets/nerd-font-symbols.png)
### 基础要求
- 安装一种 [Nerd 字体](https://www.nerdfonts.com/) 并在您的终端启用(示例使用的是 Fira Code 字体)。
### 配置
```toml
[aws]
symbol = " "
[conda]
symbol = " "
[dart]
symbol = " "
[directory]
read_only = " "
[docker_context]
symbol = " "
[elixir]
symbol = " "
[elm]
symbol = " "
[git_branch]
symbol = " "
[golang]
symbol = " "
[hg_branch]
symbol = " "
[java]
symbol = " "
[julia]
symbol = " "
[memory_usage]
symbol = " "
[nim]
symbol = " "
[nix_shell]
symbol = " "
[package]
symbol = " "
[perl]
symbol = " "
[php]
symbol = " "
[python]
symbol = " "
[ruby]
symbol = " "
[rust]
symbol = " "
[scala]
symbol = " "
[shlvl]
symbol = " "
[swift]
symbol = "ﯣ "
```
## Bracketed Segments
This preset changes the format of all the built-in modules to show their segment in brackets instead of using the default Starship wording ("via", "on", etc.).
Before:
![Screenshot of default Starship configuration](/presets/bracketed-segments-before.png)
After:
![Screenshot of Bracketed Segments preset](/presets/bracketed-segments-after.png)
### 配置
```toml
[aws]
format = '\[[$symbol($profile)(\($region\))(\[$duration\])]($style)\]'
[cmake]
format = '\[[$symbol($version)]($style)\]'
[cmd_duration]
format = '\[[⏱ $duration ]($style)\]'
[cobol]
format = '\[[$symbol($version)]($style)\]'
[conda]
format = '\[[$symbol$environment]($style)\]'
[crystal]
format = '\[[$symbol($version)]($style)\]'
[dart]
format = '\[[$symbol($version)]($style)\]'
[deno]
format = '\[[$symbol($version)]($style)\]'
[docker_context]
format = '\[[$symbol$context]($style)\]'
[dotnet]
format = '\[[$symbol($version)(🎯 $tfm)]($style)\]'
[elixir]
format = '\[[$symbol($version \(OTP $otp_version\))]($style)\]'
[elm]
format = '\[[$symbol($version)]($style)\]'
[erlang]
format = '\[[$symbol($version)]($style)\]'
[gcloud]
format = '\[[$symbol$account(@$domain)(\($region\))]($style)\]'
[git_branch]
format = '\[[$symbol$branch]($style)\]'
[git_status]
format = '([\[$all_status$ahead_behind\]]($style))'
[golang]
format = '\[[$symbol($version)]($style)\]'
[helm]
format = '\[[$symbol($version)]($style)\]'
[hg_branch]
format = '\[[$symbol$branch]($style)\]'
[java]
format = '\[[$symbol($version)]($style)\]'
[julia]
format = '\[[$symbol($version)]($style)\]'
[kotlin]
format = '\[[$symbol($version)]($style)\]'
[kubernetes]
format = '\[[$symbol$context( \($namespace\))]($style)\]'
[lua]
format = '\[[$symbol($version)]($style)\]'
[memory_usage]
format = '\[$symbol[$ram( | $swap)]($style)\]'
[nim]
format = '\[[$symbol($version)]($style)\]'
[nix_shell]
format = '\[[$symbol$state( \($name\))]($style)\]'
[nodejs]
format = '\[[$symbol($version)]($style)\]'
[ocaml]
format = '\[[$symbol($version)(\($switch_indicator$switch_name\))]($style)\]'
[openstack]
format = '\[[$symbol$cloud(\($project\))]($style)\]'
[package]
format = '\[[$symbol$version]($style)\]'
[perl]
format = '\[[$symbol($version)]($style)\]'
[php]
format = '\[[$symbol($version)]($style)\]'
[pulumi]
format = '\[[$symbol$stack]($style)\]'
[purescript]
format = '\[[$symbol($version)]($style)\]'
[python]
format = '\[[${symbol}${pyenv_prefix}(${version})(\($virtualenv\))]($style)\]'
[red]
format = '\[[$symbol($version)]($style)\]'
[ruby]
format = '\[[$symbol($version)]($style)\]'
[rust]
format = '\[[$symbol($version)]($style)\]'
[scala]
format = '\[[$symbol($version)]($style)\]'
[sudo]
format = '\[[as $symbol]\]'
[swift]
format = '\[[$symbol($version)]($style)\]'
[terraform]
format = '\[[$symbol$workspace]($style)\]'
[time]
format = '\[[$time]($style)\]'
[username]
format = '\[[$user]($style)\]'
[vagrant]
format = '\[[$symbol($version)]($style)\]'
[vlang]
format = '\[[$symbol($version)]($style)\]'
[zig]
format = '\[[$symbol($version)]($style)\]'
```
## 纯文本符号
此预设会将符号变成纯文本。 如果您的终端/字体无法渲染NerdFont/emojis也许您可以尝试此预设
前 (使用Fixedsys 字体的默认设置)
![Screenshot of default Starship configuration with Fixedsys font](/presets/plain-text-symbols-before.png)
之后(纯文本符号)
![Screenshot of Plain Text Symbols preset](/presets/plain-text-symbols-after.png)
### 配置
```toml
[character]
success_symbol = "[>](bold green)"
error_symbol = "[x](bold red)"
vicmd_symbol = "[<](bold green)"
[git_commit]
tag_symbol = " tag "
[git_status]
ahead = ">"
behind = "<"
diverged = "<>"
renamed = "r"
deleted = "x"
[aws]
symbol = "aws "
[cobol]
symbol = "cobol "
[conda]
symbol = "conda "
[crystal]
symbol = "cr "
[cmake]
symbol = "cmake "
[dart]
symbol = "dart "
[deno]
symbol = "deno "
[dotnet]
symbol = ".NET "
[directory]
read_only = " ro"
[docker_context]
symbol = "docker "
[elixir]
symbol = "exs "
[elm]
symbol = "elm "
[git_branch]
symbol = "git "
[golang]
symbol = "go "
[hg_branch]
symbol = "hg "
[java]
symbol = "java "
[julia]
symbol = "jl "
[kotlin]
symbol = "kt "
[nodejs]
symbol = "nodejs "
[memory_usage]
symbol = "memory "
[nim]
symbol = "nim "
[nix_shell]
symbol = "nix "
[ocaml]
symbol = "ml "
[package]
symbol = "pkg "
[perl]
symbol = "pl "
[php]
symbol = "php "
[pulumi]
symbol = "pulumi "
[purescript]
symbol = "purs "
[python]
symbol = "py "
[ruby]
symbol = "rb "
[rust]
symbol = "rs "
[scala]
symbol = "scala "
[sudo]
symbol = "sudo "
[swift]
symbol = "swift "
```
## 隐藏运行时版本
此预设隐藏语言运行时版本。 如果你在容器或虚拟环境中使用,这个适合你!
![Screenshot of Hide Runtime Versions preset](/presets/hide-runtime-versions.png)
### 配置
```toml
[cmake]
format = "via [$symbol]($style)"
[cobol]
format = "via [$symbol]($style)"
[crystal]
format = "via [$symbol]($style)"
[dart]
format = "via [$symbol]($style)"
[deno]
format = "via [$symbol]($style)"
[dotnet]
format = "[$symbol(🎯 $tfm )]($style)"
[elixir]
format = 'via [$symbol]($style)'
[elm]
format = 'via [$symbol]($style)'
[erlang]
format = 'via [$symbol]($style)'
[golang]
format = 'via [$symbol]($style)'
[helm]
format = 'via [$symbol]($style)'
[julia]
format = 'via [$symbol]($style)'
[kotlin]
format = 'via [$symbol]($style)'
[lua]
format = 'via [$symbol]($style)'
[nim]
format = 'via [$symbol]($style)'
[nodejs]
format = 'via [$symbol]($style)'
[ocaml]
format = 'via [$symbol(\($switch_indicator$switch_name\) )]($style)'
[perl]
format = 'via [$symbol]($style)'
[php]
format = 'via [$symbol]($style)'
[pulumi]
format = 'via [$symbol$stack]($style)'
[purescript]
format = 'via [$symbol]($style)'
[red]
format = 'via [$symbol]($style)'
[rlang]
format = 'via [$symbol]($style)'
[ruby]
format = 'via [$symbol]($style)'
[rust]
format = 'via [$symbol]($style)'
[swift]
format = 'via [$symbol]($style)'
[vagrant]
format = 'via [$symbol]($style)'
[vlang]
format = 'via [$symbol]($style)'
[zig]
format = 'via [$symbol]($style)'
```
## 纯色
此预设模拟 [Pure](https://github.com/sindresorhus/pure) 的外观和行为。
![Screenshot of Pure preset](/presets/pure-prompt.png)
### 配置
```toml
format = """
$username\
$hostname\
$directory\
$git_branch\
$git_state\
$git_status\
$cmd_duration\
$line_break\
$python\
$character"""
[directory]
style = "blue"
[character]
success_symbol = "[](purple)"
error_symbol = "[](red)"
vicmd_symbol = "[](green)"
[git_branch]
format = "[$branch]($style)"
style = "bright-black"
[git_status]
format = "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)"
style = "cyan"
conflicted = ""
untracked = ""
modified = ""
staged = ""
renamed = ""
deleted = ""
stashed = "≡"
[git_state]
format = '\([$state( $progress_current/$progress_total)]($style)\) '
style = "bright-black"
[cmd_duration]
format = "[$duration]($style) "
style = "yellow"
[python]
format = "[$virtualenv]($style) "
style = "bright-black"
```