starship是一个轻量、迅速、客制化的高颜值终端提示符软件!本篇对其进行简单介绍。
安装
参考官网starship ,这里只介绍在Ubuntu上的按照方法:
1 2
| curl -sS https://starship.rs/install.sh | sh
|
配置
设置shell以sharship自启动
1 2 3 4 5 6
|
echo 'eval "$(starship init bash)"' >> ~/.bashrc
echo 'eval "$(starship init zsh)"' >> ~/.zshrc
|
在配置文件中定制化
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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
| mkdir -p ~/.config && touch ~/.config/starship.toml
cat > ~/.config/starship.toml <<-"EOF"
format = """\ [╭╴](fg:arrow)\ $username\ $hostname\ (\ at \ $directory \ )\ $git_branch\ $git_state\ $git_status\ $git_commit\ $cmd_duration\ $memory_usage\ (\ $python\ $conda\ $nodejs\ $c\ $rust\ $java\ ) [╰─](fg:arrow)$time$character\ """
[battery] full_symbol = "🔋" charging_symbol = "🔌" discharging_symbol = "⚡"
[[battery.display]] threshold = 30 style = "bold red"
[character] success_symbol = '[->](bold green)' error_symbol = "[->](bold red)"
[cmd_duration] min_time = 10_000 format = "took [$duration]($style)"
[directory] truncation_length = 5 format = "[$path]($style)[$lock_symbol]($lock_style)"
[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"
[hostname] ssh_only = false format = "[$hostname]($style) " trim_at = "." style = "bold dimmed white" disabled = false
[julia] format = "[$symbol$version]($style) " symbol = "ஃ " style = "bold green"
[memory_usage] format = "$symbol[${ram}( | ${swap})]($style) " threshold = 10 style = "bold dimmed white" disabled = false
[package] disabled = true
[python] format = "[$symbol$version]($style) " style = "bold green"
[rust] format = "[$symbol$version]($style) " style = "bold green"
[golang] format = 'via [$symbol($version )]($style)' version_format = 'v${raw}' style = 'bold cyan' symbol = "🐹 "
[time] time_format = "%A %Y-%m-%d %T" format = "$time($style) "
style = "bright-white" disabled = false
[typst] format = "[$symbol($version)]($style)" style = "bold #239dae"
[username] style_user = "bold dimmed blue" show_always = true
[nodejs] format = "via [🤖 $version](bold green) "
EOF
|