Starship官网:https://starship.rs/

一、安装

首先需要先安装scoop,参考:
📃 Scoop包管理

通过scoop安装:

  1. $ scoop install starship
  2. Installing 'starship' (0.48.0) [64bit]
  3. starship-x86_64-pc-windows-msvc.zip (2.1 MB) [================================================================] 100%
  4. Checking hash of starship-x86_64-pc-windows-msvc.zip ... ok.
  5. Extracting starship-x86_64-pc-windows-msvc.zip ... done.
  6. Linking ~\scoop\apps\starship\current => ~\scoop\apps\starship\0.48.0
  7. Creating shim for 'starship'.
  8. 'starship' (0.48.0) was installed successfully!
  9. Notes
  10. -----
  11. Usage: Add 'Invoke-Expression (&starship init powershell)' to the end of your PowerShell $PROFILE.
  12. Prerequisites: A Powerline font installed and enabled in your terminal.
  13. 'starship' suggests installing 'extras/vcredist2019'.
  14. PS C:\WINDOWS\system32> Invoke-Expression (&starship init powershell)

安装完后,使用命令激活此shell:

  1. Invoke-Expression (&starship init powershell)

如果需要每次启动都激活,可以将此命令加入PowerShell Profile,路径如下:
语雀内容

启动后效果如下:
Snipaste_2021-01-15_16-36-25.webp

在VSCode中的表现:
Snipaste_2021-01-15_17-35-56.webp

二、配置

配置文件 %USERPROFILE%\.config\starship.toml

  1. # Don't print a new line at the start of the prompt
  2. add_newline = false
  3. # Replace the "❯" symbol in the prompt with "➜"
  4. [character] # The name of the module we are configuring is "character"
  5. success_symbol = "[➜](bold green)" # The "success_symbol" segment is being set to "➜" with the color "bold green"
  6. # Enable the package module, showing it from the prompt completely
  7. [package]
  8. disabled = false
  9. [nodejs]
  10. format = "via [⬢ nodejs $version](bold green) "
  11. [python]
  12. format = "via [🐍 python $version](bold green) "

在VSCode中:
Snipaste_2021-01-15_17-52-06.webpSnipaste_2021-01-15_17-52-21.webp

在WebStrom中:
Snipaste_2021-01-18_09-32-19.webp

参考:https://starship.rs/zh-cn/config/

参考资料

https://zhuanlan.zhihu.com/p/158367240