美化后的 terminal prompt 的样子如下所示:
~/.config/starship.toml,配置如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
format = """
$status \
${custom.tztime} \
${custom.uptime} \
$username\
$hostname\
$shlvl\
$kubernetes\
$directory\
$git_branch\
$git_commit\
$git_state\
$git_status\
$docker_context\
$package\
$cmake\
$nodejs\
$perl\
$python \
$ruby\
$rust\
$terraform\
$vagrant\
$nix_shell\
$conda\
$aws \
$env_var\
$cmd_duration\
$line_break\
$character"""
# Inserts a blank line between shell prompts
add_newline = false
continuation_prompt = "▶▶"
[container]
disabled = true
[username]
style_user = "green bold"
style_root = "red bold"
format = "[$user]($style)"
disabled = false
show_always = false
# Replace the "❯" symbol in the prompt with "➜"
[character] # The name of the module we are configuring is "character"
success_symbol = "[🌈](bold green)" # The "success_symbol" segment is being set to "➜" with the color "bold green"
error_symbol = " [λ](bold red)"
[cmd_duration]
min_time = 1000
[golang]
format = "via [🏎💨 $version](bold cyan) "
[git_branch]
format = " [$symbol$branch]($style) "
symbol = "🍣 "
style = "bold yellow"
[git_commit]
commit_hash_length = 8
style = "bold white"
[git_state]
format = '[\($state( $progress_current of $progress_total)\)]($style) '
[git_status]
conflicted = "⚔️ "
ahead = "🏎️ 💨 ×${count}"
behind = "🐢 ×${count}"
diverged = "🔱 🏎️ 💨 ×${ahead_count} 🐢 ×${behind_count}"
untracked = "🛤️ ×${count}"
stashed = "📦 "
modified = "📝 ×${count}"
staged = "🗃️ ×${count}"
renamed = "📛 ×${count}"
deleted = "🗑️ ×${count}"
style = "bright-white"
format = "$all_status$ahead_behind"
[sudo]
style = "bold green"
symbol = "👩💻 "
disabled = false
# Disable the package module, hiding it from the prompt completely
[package]
disabled = true
[directory]
truncation_length = 100
truncate_to_repo = false
style = "yellow"
format = "[:$path]($style)[$read_only]($read_only_style) "
[custom.uptime]
command = "~/.script/uptime.sh"
when = "true"
format = "[$symbol($output)](green)"
[custom.tztime]
command = 'TZ=Asia/Shanghai date +"%a %b %d %Y %l:%M%p (%Z%z)"'
when = "true"
format = '[\[$symbol($output)\]](green)'
[env_var]
variable = "0"
[status]
disabled = false
format = '[\[$status - $common_meaning\]](green)'
[time]
disabled = true
|