Starship 配置属于自己的🌈命令行

青苗 ㅤ 青苗 ㅤ | 905 | 2023-02-27

安装

官方文档

1.选择喜欢的方式安装

跨平台,随意安装

062635e5d5584025b6bdd36980d13efb.png

2.配置终端

我在 IDEA 中使用的是 git bash 来代替默认的 terminal。所以我的终端是 Bash。只需在 ~/.bashrc 中配置即可(~ 表示用户的根目录即 $HOME 目录)。

84bc58d0c31d4be48968ee6d0fda4faa.png

3.配置属于自己的终端样式

官方配置 中可以配置提示符、语言 Logo 等等,来改变你自己的样式。
也可以在 社区分享 中找到属于你自己的 Style。
以下是我的配置;

format = """
[](#9A348E)\
$username\
[](bg:#DA627D fg:#9A348E)\
$directory\
[](fg:#DA627D bg:#FCA17D)\
$git_branch\
$git_status\
[](fg:#FCA17D bg:#86BBD8)\
$c\
$elixir\
$elm\
$golang\
$haskell\
$java\
$julia\
$nodejs\
$nim\
$rust\
[](fg:#86BBD8 bg:#06969A)\
$docker_context\
[](fg:#06969A bg:#33658A)\
$time\
[ ](fg:#33658A)\
"""

# Disable the blank line at the start of the prompt
# add_newline = false

# You can also replace your username with a neat symbol like  to save some space
[username]
show_always = true
style_user = "bg:#9A348E bold"
style_root = "bg:#9A348E bold"
format = '[$user ]($style)'

[directory]
style = "bg:#DA627D"
format = "[ $path ]($style)"
truncation_length = 3
truncation_symbol = "…/"

# Here is how you can shorten some long paths by text replacement
# similar to mapped_locations in Oh My Posh:
[directory.substitutions]
"Documents" = " "
"Downloads" = " "
"Music" = " "
"Pictures" = " "
# Keep in mind that the order matters. For example:
# "Important Documents" = "  "
# will not be replaced, because "Documents" was already substituted before.
# So either put "Important Documents" before "Documents" or use the substituted version:
# "Important  " = "  "

[c]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8  fg:#393939)]($style)'

[docker_context]
symbol = " "
style = "bg:#06969A"
format = '[[ $symbol $context ](bg:#06969A  fg:#393939)]($style) $path'

[git_branch]
symbol = ""
style = "bg:#FCA17D"
format = '[[ $symbol $branch ](bg:#FCA17D fg:#2a4150)]($style)'

[git_status]
style = "bg:#FCA17D"
format = '[[($all_status$ahead_behind )](bg:#FCA17D fg:#5b7d86)]($style)'

[golang]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8  fg:#393939)]($style)'

[java]
symbol = " "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8 fg:#393939)]($style)'

[nodejs]
symbol = ""
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8  fg:#393939)]($style)'

[rust]
symbol = ""
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8  fg:#393939)]($style)'

[time]
disabled = false
time_format = "%T" # Hour:Minute:Second Format
style = "bg:#33658A "
format = '[[ ♥ $time ](bg:#33658A bold)]($style)'

效果如下:

f657f6a729174e5487eca9a29a0db262.png
当然 U style,你自己可以来定义:-)

文章标签: 后端开发环境
推荐指数:

真诚点赞 诚不我欺~

Starship 配置属于自己的🌈命令行

点赞 收藏 评论

关于作者

青苗 ㅤ
青苗 ㅤ

青苗幼儿园园长

等级 LV1

粉丝 0

获赞 0

经验 22